Jenkins Approval Pipeline: A Simple Example for Smooth Deployment
When managing a Jenkins pipeline, you must control the flow of operations and ensure approval before proceeding to critical stages like deployment. A Jenkins approval pipeline helps streamline this process by integrating user input and approval steps before the pipeline moves forward. In this article, we’ll explore a straightforward example of how to implement a Jenkins approval pipeline using the input directive with a timeout feature.

Step 1: Set Up the Build Stage
Every Jenkins pipeline typically begins with a build process. This is where you compile or prepare the application for deployment. Here’s an example of the build stage in your Jenkinsfile:
pipeline {
agent any
stages {
stage("Build") {
steps {
echo "Building Application"
}
}
}
}
This stage is simple and focuses on executing the build for the application. It serves as the foundational step before moving to the more critical parts of your pipeline, such as approval and deployment.
Step 2: Add an Approval Stage
In many deployment processes, you must obtain approval from a user before proceeding with deployment. The approval stage in Jenkins introduces a manual step in the pipeline. Using the input directive, Jenkins will wait for the user’s approval to continue. If no response arrives within the specified timeout, the stage aborts, preventing the pipeline from proceeding to deployment.
Here’s how you implement the approval stage:
stage("Get Approval") {
options {
timeout(time: 1, unit: 'MINUTES')
}
steps {
input "Please approve to proceed with deployment"
}
}
In this example, Jenkins pauses the pipeline for 1 minute, awaiting user input. If no approval comes within that time, the pipeline moves forward without executing the deployment stage.
Step 3: Execute the Deployment Stage
Once the approval comes through, the pipeline moves to the deployment stage, where the application deploys. Here’s the code for this stage:
stage("Deployment") {
steps {
echo "Deploying Application"
}
}
This stage deploys the application after the approval process completes. It’s essential to ensure no deployment happens without the necessary approval to avoid errors or unintended releases.
Why Jenkins Approval Pipelines Matter
In complex DevOps environments, you need manual approval processes to ensure security and control. This step becomes even more crucial when working in industries where team members must verify changes before pushing them to production. Jenkins approval pipelines help maintain control and security, ensuring no actions proceed without confirmation.
Moreover, ZippyOPS enhances your Jenkins workflows with a range of DevOps, DevSecOps, and Cloud solutions. ZippyOPS offers consulting, implementation, and managed services, helping you automate operations, strengthen infrastructure, and enhance security. From AIOps to Microservices, ZippyOPS provides tailored solutions for companies looking to optimize their CI/CD pipelines.
For more on how to integrate these capabilities, explore ZippyOPS’ services and solutions.
Conclusion: Streamline Your Pipeline with Approval Stages
Incorporating an approval stage into your Jenkins pipeline gives you better control and security over deployments. By using the input directive with a timeout, you can automate the process while still requiring manual oversight when necessary.
For more advanced DevOps strategies or if you’re looking to optimize your operations with MLOps, Infrastructure, or DataOps, ZippyOPS is ready to assist. Reach out today at sales@zippyops.com to discuss how we can tailor our services to your specific needs.



