Using Jenkins Input Step for Interactive Pipeline Execution
This article explains how to add interactive user input to Jenkins pipelines by installing the Pipeline: InputStep plugin, configuring a Jenkinsfile with various parameter types, and reviewing the resulting console output, enabling more flexible DevOps workflows.
Interactive input is common in shell scripts (using read) and Python (using input()); this article shows how to achieve similar interaction within Jenkins pipelines using the InputStep plugin.
First, install the "Pipeline: InputStep" plugin from the Jenkins plugin manager (https://plugins.jenkins.io/pipeline-input-step) and verify the installation with the provided screenshots.
Next, create or edit a Jenkinsfile that uses the input step to prompt the user. The example below demonstrates a stage named "test" that asks "是否执行应用回滚?" (whether to roll back the application), with a custom ID, confirmation button text, submitter restriction, and additional parameters such as a string parameter for the service name and a custom submitter parameter.
node(){
stage("test"){
result = input id: '123',
message: '是否执行应用回滚?',
ok: '是的',
parameters: [string(defaultValue: 'devops-service', description: '', name: 'serviceName', trim: false)],
submitter: 'lizeyang',
submitterParameter: 'a=1'
println(result)
}
}The console output after running the pipeline shows the input request, approval by the specified user, and the printed result containing the supplied parameters.
Beyond simple string inputs, the InputStep supports multiple parameter types—including string, choice, multi-select, boolean, credentials, and others—allowing you to cover most everyday use cases.
In summary, the InputStep plugin enables interactive decision points in Jenkins pipelines, making them more flexible, though some parameter types may still lack full support in the Blue Ocean UI.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
