0
0
Jenkinsdevops~30 mins

Pipeline triggers and upstream/downstream in Jenkins - Mini Project: Build & Apply

Choose your learning style9 modes available
Pipeline triggers and upstream/downstream
📖 Scenario: You work in a team where multiple Jenkins pipelines depend on each other. One pipeline builds the application, and another deploys it. You want the deploy pipeline to start automatically after the build pipeline finishes successfully.
🎯 Goal: Build two Jenkins pipelines where the deploy pipeline is triggered automatically after the build pipeline completes. You will create the build pipeline, configure the deploy pipeline to trigger after the build, and verify the trigger works.
📋 What You'll Learn
Create a Jenkins pipeline named BuildApp with a simple build step
Create a Jenkins pipeline named DeployApp
Configure DeployApp to trigger automatically after BuildApp completes
Print a message in DeployApp to confirm it was triggered
💡 Why This Matters
🌍 Real World
In real projects, build and deploy pipelines often depend on each other. Automating triggers saves time and reduces errors.
💼 Career
Understanding pipeline triggers is essential for DevOps engineers to create efficient CI/CD workflows.
Progress0 / 4 steps
1
Create the BuildApp pipeline
Create a Jenkins pipeline named BuildApp with a pipeline block. Inside the stages, add one stage named Build that runs a shell command to print Building application....
Jenkins
Need a hint?

Use pipeline block with agent any. Inside stages, add a stage('Build') with steps running sh 'echo Building application...'.

2
Create the DeployApp pipeline
Create a Jenkins pipeline named DeployApp with a pipeline block. Inside the stages, add one stage named Deploy that runs a shell command to print Deploying application....
Jenkins
Need a hint?

Similar to the build pipeline, create a pipeline block with agent any. Add a stage('Deploy') with steps running sh 'echo Deploying application...'.

3
Configure DeployApp to trigger after BuildApp
In the DeployApp pipeline, add a triggers block inside the pipeline block. Use the upstream trigger to start DeployApp automatically after BuildApp completes successfully.
Jenkins
Need a hint?

Inside the DeployApp pipeline, add triggers { upstream('BuildApp') } to trigger after the build pipeline.

4
Print confirmation in DeployApp pipeline
Add a post block inside the DeployApp pipeline. In the success section, add a step to print DeployApp triggered after BuildApp to confirm the trigger worked.
Jenkins
Need a hint?

Use a post block with success inside the DeployApp pipeline to print the confirmation message.