Course contentsShow
← Cloud and Infrastructure
Lesson 1796 of 2,98937. JenkinsFree lesson

Input Steps for Manual Approval

Pause pipeline execution for manual approval or user input before proceeding to deployment stages.

Input Steps for Manual Approval

What you'll learn: How to pause your Jenkins pipeline and wait for human approval or input before continuing critical operations like production deployments.

The Need for Human Checkpoints

Not every pipeline step should run automatically. Sometimes you need a human to review logs, verify test results, or confirm that a production deployment should proceed. Jenkins input steps let you inject these manual approval gates directly into your pipeline flow.

Think of it like a factory assembly line with a quality inspector station—the line pauses until the inspector signs off, then continues.

How Input Steps Work

In a Declarative Pipeline, you use the input directive within a stage to halt execution:

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                echo 'Building application...'
            }
        }
        stage('Deploy to Production') {
            input {
                message "Deploy to production?"
                ok "Yes, deploy it!"
            }
            steps {
                echo 'Deploying to production...'
            }
        }
    }
}

When the pipeline reaches this stage, Jenkins displays a prompt in the UI. The build pauses until someone clicks the approval button. You can customize the message and button text to make the decision clear.

Capturing User Input

You can also collect information from users:

input {
    message "Select deployment environment"
    parameters {
        choice(name: 'ENV', choices: ['staging', 'production'], description: 'Target environment')
    }
}

The selected value becomes available as a variable (ENV) in subsequent steps.

Key Takeaway: Input steps transform Jenkins from a fully automated system into a semi-automated workflow where humans approve critical decisions, providing safety gates before irreversible actions like production deployments.