Bird
Raised Fist0
Jenkinsdevops~10 mins

Input step for manual approval in Jenkins - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - Input step for manual approval
Pipeline reaches input step
↓
Pause execution, wait for user
↓
User sees prompt in Jenkins UI
↓
User clicks Approve or Abort
↓
Approve
↓
Continue
The pipeline pauses at the input step, waits for a user to approve or abort, then continues or stops based on the choice.
Execution Sample
Jenkins
pipeline {
  agent any
  stages {
    stage('Approval') {
      steps {
        input 'Approve deployment?'
      }
    }
  }
}
This Jenkins pipeline pauses at the input step asking for manual approval before continuing.
Process Table
StepPipeline StateActionUser InteractionResult
1Running before inputReach input stepNoPipeline pauses, waiting
2Paused at inputWait for userYes - prompt shownUser sees approval prompt
3Paused at inputUser clicks ApproveYes - user approvesPipeline resumes execution
4Running after inputContinue pipelineNoNext stages run
5Paused at inputUser clicks AbortYes - user abortsPipeline stops with failure
💡 Pipeline stops or continues based on user approval or abort action
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
pipeline_stateNot startedRunning before inputPaused at inputRunning after inputCompleted or Aborted
Key Moments - 3 Insights
Why does the pipeline pause and not continue automatically?
Because the input step waits for manual approval, as shown in execution_table row 1 and 2, the pipeline pauses until the user responds.
What happens if the user clicks Abort instead of Approve?
As shown in execution_table row 5, the pipeline stops immediately with failure and does not continue.
Can the pipeline continue without user interaction at the input step?
No, the pipeline stays paused at the input step until the user approves or aborts, as seen in execution_table rows 2 and 3.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the pipeline state after the user clicks Approve?
APaused at input
BRunning after input
CStopped
DNot started
💡 Hint
Check execution_table row 3 and 4 for pipeline state after approval
At which step does the pipeline show the approval prompt to the user?
AStep 2
BStep 4
CStep 1
DStep 5
💡 Hint
Look at execution_table row 2 where user interaction is 'Yes - prompt shown'
If the user aborts at the input step, what is the pipeline result?
APipeline continues to next stage
BPipeline pauses indefinitely
CPipeline stops with failure
DPipeline restarts
💡 Hint
See execution_table row 5 for user abort action result
Concept Snapshot
Jenkins input step pauses pipeline for manual approval.
Pipeline waits until user approves or aborts.
Approve resumes pipeline; abort stops it.
Used to add human checks in automated flows.
Syntax: input 'Prompt message'.
Full Transcript
In Jenkins pipelines, the input step pauses the pipeline execution and waits for a manual approval from a user. When the pipeline reaches this step, it stops and shows a prompt in the Jenkins user interface. The user can then choose to approve or abort the pipeline. If approved, the pipeline continues running the next stages. If aborted, the pipeline stops immediately with failure. This allows adding human checks in automated processes to prevent unwanted deployments or actions. The pipeline state changes from running to paused at the input step, then back to running or stopped based on user choice.

Practice

(1/5)
1. What is the main purpose of the input step in a Jenkins pipeline?
easy
A. To send email notifications
B. To automatically deploy the application
C. To run tests in parallel
D. To pause the pipeline and wait for manual approval

Solution

  1. Step 1: Understand the role of the input step

    The input step is designed to pause the pipeline execution and wait for a user to approve or reject the continuation.
  2. Step 2: Compare with other pipeline actions

    Other options like deployment, testing, or notifications are handled by different steps, not input.
  3. Final Answer:

    To pause the pipeline and wait for manual approval -> Option D
  4. Quick Check:

    Input step = manual pause [OK]
Hint: Input step always waits for user action [OK]
Common Mistakes:
  • Confusing input with automated steps
  • Thinking input triggers deployment
  • Assuming input sends notifications
2. Which of the following is the correct syntax to add a manual approval input step in a Jenkins declarative pipeline?
easy
A. input message: 'Approve deployment?'
B. input('Approve deployment?')
C. input { message: 'Approve deployment?' }
D. input message = 'Approve deployment?'

Solution

  1. Step 1: Recall Jenkins input step syntax

    The correct syntax uses the input step with named parameters like message: 'text'.
  2. Step 2: Check each option

    input message: 'Approve deployment?' matches the correct syntax. Options A, B, and D use incorrect formats or braces.
  3. Final Answer:

    input message: 'Approve deployment?' -> Option A
  4. Quick Check:

    Correct input syntax uses named parameters [OK]
Hint: Use named parameters with colon for input step [OK]
Common Mistakes:
  • Using parentheses instead of named parameters
  • Using braces instead of parentheses
  • Assigning message with equals sign
3. Given the following Jenkins scripted pipeline snippet, what will happen when it reaches the input step?
node {
  stage('Build') {
    echo 'Building...'
  }
  stage('Approval') {
    input message: 'Proceed with deployment?'
  }
  stage('Deploy') {
    echo 'Deploying...'
  }
}
medium
A. Pipeline pauses and waits for user approval before deploying
B. Pipeline skips the approval and deploys immediately
C. Pipeline fails with a syntax error
D. Pipeline runs all stages without pause

Solution

  1. Step 1: Analyze the input step behavior

    The input step pauses the pipeline and waits for a user to approve before continuing.
  2. Step 2: Understand pipeline flow

    After approval, the pipeline proceeds to the Deploy stage. Without approval, it stays paused.
  3. Final Answer:

    Pipeline pauses and waits for user approval before deploying -> Option A
  4. Quick Check:

    Input step pauses pipeline = Pipeline pauses and waits for user approval before deploying [OK]
Hint: Input step always pauses pipeline until user approves [OK]
Common Mistakes:
  • Assuming input step is skipped automatically
  • Thinking input causes syntax error
  • Believing pipeline runs all stages without pause
4. Identify the error in this Jenkins pipeline snippet that uses an input step:
pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        input message: 'Approve test run?'
        echo 'Running tests...'
      }
    }
  }
}
medium
A. The message parameter is missing quotes
B. The input step cannot be used in the Test stage
C. The input step must be inside a script block in declarative pipeline
D. The echo step must come before the input step

Solution

  1. Step 1: Understand declarative pipeline input usage

    In declarative pipelines, the input step must be wrapped inside a script block to run scripted steps.
  2. Step 2: Check the snippet

    The input step is directly inside steps without script, causing a syntax error.
  3. Final Answer:

    The input step must be inside a script block in declarative pipeline -> Option C
  4. Quick Check:

    Input in declarative needs script block [OK]
Hint: Wrap input step in script block in declarative pipelines [OK]
Common Mistakes:
  • Placing input step directly in steps without script
  • Missing quotes around message
  • Thinking input can't be used in certain stages
5. You want to add a manual approval step in a Jenkins declarative pipeline that asks the user to confirm deployment with a custom message and a timeout of 1 hour. Which snippet correctly implements this?
hard
A. input message: 'Deploy now?', timeout: 3600
B. script { input message: 'Deploy now?', timeout: 3600 }
C. script { input message: 'Deploy now?', timeout: 60, submitter: 'admin' }
D. script { input message: 'Deploy now?', timeout: 60 }

Solution

  1. Step 1: Understand timeout parameter unit

    The timeout parameter for input is in seconds, so 1 hour = 3600 seconds.
  2. Step 2: Check declarative pipeline syntax

    Input must be inside a script block in declarative pipelines.
  3. Step 3: Evaluate options

    script { input message: 'Deploy now?', timeout: 3600 } correctly uses script block and timeout 3600 seconds. script { input message: 'Deploy now?', timeout: 60 } uses 60 (1 minute), B lacks script block, C adds submitter but timeout is 60 seconds.
  4. Final Answer:

    script { input message: 'Deploy now?', timeout: 3600 } -> Option B
  5. Quick Check:

    Timeout in seconds + script block = script { input message: 'Deploy now?', timeout: 3600 } [OK]
Hint: Timeout is seconds; use script block in declarative [OK]
Common Mistakes:
  • Using timeout in minutes instead of seconds
  • Omitting script block in declarative pipeline
  • Adding unnecessary parameters
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard