#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
Jenkins · Topic 14 of 15

Input Function in Pipeline

By Uncodemy Editorial Team · Updated 16 Nov 2026

What input does

input pauses a running pipeline and waits for a person to click a button. It is how teams put a manual approval in front of a risky stage: build and test run automatically, then the pipeline waits until someone with the right permission says "Deploy" or clicks "Abort". Approve, and the pipeline continues; abort, and the build ends with the result ABORTED.

The declarative way: an input directive on the stage

pipeline {
    agent none                               // no agent held for the whole run
    stages {
        stage('Build and test') {
            agent any
            steps { sh './build.sh && ./test.sh' }
        }
        stage('Deploy to production') {
            agent any
            options { timeout(time: 4, unit: 'HOURS') }
            input {
                message 'Deploy this build to production?'
                ok 'Deploy'
                submitter 'release-managers'  // user IDs or group names, comma-separated
                submitterParameter 'APPROVER'
                parameters {
                    choice(name: 'SLOT', choices: ['blue', 'green'], description: 'Target slot')
                }
            }
            steps {
                echo "Approved by ${APPROVER}, deploying to ${SLOT}"
                sh './deploy.sh "$SLOT"'
            }
        }
    }
}

Why this shape works well:

What the approver sees

  1. The Stage View shows the "Deploy to production" box as paused. Hovering it, or opening the build's console, shows the message with Deploy and Abort buttons. The build also has a Paused for Input link in its menu.
  2. Because a parameter was added, the approver first picks blue or green from a drop-down.
  3. Users who are not in release-managers cannot approve; Jenkins rejects their click.
  4. The console log records who approved or aborted the step.

Who counts as a submitter depends on your users and groups; see Jenkins user management.

The step form, inside a script block

When you need the answer as a Groovy value, call input as a step:

stage('Confirm') {
    steps {
        script {
            def reason = input(
                message: 'Release despite failing lint?',
                ok: 'Release',
                parameters: [string(name: 'REASON', defaultValue: '', description: 'Why?')]
            )
            echo "Released with reason: ${reason}"
        }
    }
}

With exactly one parameter, input returns that value. With several, it returns a map keyed by parameter name. With none, it returns nothing useful; it only pauses. If you use the step form inside a stage that has an agent, wrap it in timeout(time: 1, unit: 'HOURS') { ... } and remember the executor is held while waiting.

Common errors

Related topics: pipeline parameters (values chosen at the start of a build) and post-build actions (for example, notify the team when a build is aborted).

Master Jenkins & DevOps with Uncodemy

Hands-on live training, real projects and Dedicated Placement Support — become job-ready in DevOps.

Enroll in DevOps Training →