Hi All, this document deals how to Setup build a pipeline in Jenkins. Jenkins is one of the best Continous Integration and Continous delivery tool used by DevOps.
Using Pipeline you can have many jobs to run as single and provide you a detail report on this.
Jenkins is an open source automation server written in Java. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery. It is a server-based system that runs in servlet containers such as Apache Tomcat.
In this document, I will be creating 3 sample jobs and chaining all these jobs to start one job after other. Here I will be using a Build Pipeline to perform this action.
* working Jenkins Server, if you haven’t installed yet, the check this document for that.
Once you Installed Jenkins server, here are the steps to do job chaining in Jenkins.
Step 1: Install Build Pipeline Plugin, from Manage Jenkins – Plugin – Available
Step 2: Now I will create the first job. Build option varies from your environment.
In my first job, I’m just printing a line, you can do with java application and it’s up to you.
Step 3: Now I will create the second job in the same way, but in this job you have to add a build trigger – Build after other projects are built and select your first Job.
In Build I’m just print a line using Execute shell.
Step 4: Now the final Job 3 I’m creating the same way how Job 2 is created. In build Trigger, this job will Execute after Job 2.
Step 5: Now Goto your Jenkins dashboard, you can see all the 3 jobs which created before.
Step 6: Now click on the + button and select Build Pipeline View.
Step 7: In the Configuration of Build pipeline view – Layout – Select based on upstream/downstream relationship. And select initial job as the first Job which created before, In my case itis Test1, it may differ from your environment.
Step 8: Now you can see the Build pipeline view as give below.
Step 9: Noe click on the RUN button to start the Job.
Step 10: Now you can see that the all the job are getting Executed in a sequence order in the way which we have given.
Step 11: Success Job is shown in Green color and Running jobs are shown in blue color.
Step 12: You can see the logs of each job by selecting the CMD button.
© 2019, Techrunnr. All rights reserved.