Input step for manual approval in Jenkins - Time & Space Complexity
We want to understand how the time taken by a Jenkins pipeline changes when it includes a manual approval step.
Specifically, how does waiting for user input affect the overall execution time?
Analyze the time complexity of the following Jenkins pipeline snippet with a manual approval step.
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
stage('Approval') {
steps {
input message: 'Approve deployment?', ok: 'Yes'
}
}
stage('Deploy') {
steps {
echo 'Deploying...'
}
}
}
}
This pipeline runs a build, then waits for manual approval before deploying.
Look for loops or repeated actions that affect time.
- Primary operation: The pipeline waits once for manual approval.
- How many times: Exactly one input step pause per pipeline run.
The waiting time depends on how long a person takes to approve, not on input size.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | Build + 1 approval wait + Deploy |
| 100 | Build + 1 approval wait + Deploy |
| 1000 | Build + 1 approval wait + Deploy |
Pattern observation: The manual approval wait does not grow with input size; it is a fixed pause.
Time Complexity: O(1)
This means the waiting time for manual approval stays the same regardless of input size.
[X] Wrong: "The manual approval step makes the pipeline time grow with the number of builds."
[OK] Correct: Each pipeline run waits once for approval; the wait time does not multiply by input size within a single run.
Understanding how manual steps affect pipeline timing helps you design efficient workflows and explain delays clearly.
What if we added a loop that asks for approval multiple times in one pipeline run? How would the time complexity change?