Problem Statement
What does the 'input' step do in Jenkins Pipeline?
Explanation
The input step pauses pipeline execution waiting for human approval or input before proceeding. Common uses include manual approval before production deployment, confirming release version, or providing environment-specific parameters. Pipeline shows prompt in UI with options to proceed or abort, and optionally request input parameters.
Basic approval:
```groovy
stage('Deploy to Production') {
steps {
input message: 'Deploy to production?', ok: 'Deploy'
sh './deploy-prod.sh'
}
}
```
With parameters:
```groovy
def userInput = input(
message: 'Select deployment environment',
parameters: [
choice(choices: ['staging', 'production'], name: 'ENVIRONMENT'),
string(name: 'VERSION', defaultValue: '1.0.0', description: 'Version to deploy')
]
)
sh "./deploy.sh ${userInput.ENVIRONMENT} ${userInput.VERSION}"
```
Input options include submitter (restrict who can approve), submitterParameter (capture approver's username), timeout (abort if no response within time). Use outside node block in Declarative Pipeline to avoid blocking executor while waiting. Understanding input step enables implementing approval gates and human-in-the-loop processes in automated pipelines.
