Devops Tutorial 22 - Jenkins Delivery Pipeline
What you will Learn:
Stages in Continuous delivery and deployment
Continuous Integration
What is a Pipeline
Install ‘Managed Scripts’ plugin
Add path of shell executable
Setup Delivery pipeline (create jobs)
Setup Delivery pipeline (chain jobs)
Setup Delivery pipeline (install ‘Delivery pipeline’ plugin)
Stages in Continuous delivery and deployment
Stage 1: We start with creating or building a software product
Stage 2: We then deploy it to test environment
Stage 3: We then test it
Stage 4: We finally release it to production environment
Now, all the stages have Jenkins jobs associated with them.
Continuous Integration
All the above jobs that we talked about are chained or integrated together. What this means is that, once the ‘Build’ jobs are executed successfully, the ‘Deploy’ jobs are triggered. The successful ‘Deploy’ jobs trigger ‘Test’ jobs and so on.
So all jobs are chained in a continuous integration fashion
What is a Pipeline
Pipeline is simply a group of jobs that are chained with each other
The above pipeline can also be referred to as continuous delivery pipeline since all jobs are integrated together.
Install ‘Managed Scripts’ plugin
Manage jenkins > Manage Plugins > Install ‘Managed Scripts’ plugin
Add path of shell executable
Manage jenkins > Configure System > Add path of shell executable
You can find out the path by running the ‘where sh’ command in Git bash window
Setup Delivery pipeline in Jenkins (create jobs)
Start Jenkins and login
Let us create 3 simple freestyle jobs. We will chain them later
Select ‘Execute shell’ from the ‘Add build step’ dropdown, see below
Enter an echo statement, see below
Apply and save
Similarly create ‘DeployJob’
Similarly create ‘TestJob’
So we have created 3 jobs
Important note: Make sure that the 3 jobs are running fine individually
Setup Delivery pipeline in Jenkins (chain jobs)
We will now chain the 3 jobs that we have created. To do that, let us configure DeployJob first
Select ‘Build after other projects are built’ checkbox
Enter ‘BuildJob’ in the text field. So what this means is that, ‘DeployJob’ will get executed only if ‘BuildJob’ is success
Apply and Save
Similarly configure ‘TestJob’
Apply and Save
So we have chained the 3 jobs.
To validate this, execute ‘BuildJob’
Notice below that DeployJob gets executed automatically after BuildJob is success
Notice below that TestJob gets executed automatically after DeployJob is success
Setup Delivery pipeline in Jenkins (‘Delivery pipeline’ plugin)
Install ‘Delivery pipeline’ plugin
Important note: Restart jenkins after installing plugin
In the next article, we will continue and see how to add a delivery pipeline view.
Thank you for reading!