Jaswinder Singh
Jaswinder Singh
DevOps Engineer

How to Create Jenkins Pipeline using Build Pipeline.

In this post you will learn how to create jenkins pipeline.

What is a pipeline in Jenkins?
In literary terms, we can say that the pipeline is a workflow with a group of events or jobs that are chained together and work in a sequence. In other words, its mechanism is similar to a pipe and every pipe has an inlet and an outlet. But what exactly is pipeline still remains a question. The answer to which is that a pipeline will consist of multiple sections of a pipe and can have multiple inlets and outlets where every section processes something and this processing in our case is done by jobs.

Here’s an example that can bring more clarity to the concept of build pipeline;

Steps to create Jenkin Jobs:-


Step1 : Create the first Jenkins job on the Jenkins dashboard, click on New Item on the top under dashboard.

- Advertisement -

Then, enter the item name (In my project, I have entered Build-Project-1 in item name) and select freestyle project, then click ok.

Now, go to build section, click on add build step and select Execute Shell from the dropdown.

This will open an execute shell box where commands for the build can be written, and here, I am just printing the text with the echo command. (You can run any other command as per your environment or need), then click on Apply and Save.

Step2 : Create the Second Jenkins job.
For creating second job, follow the same process as mentioned in step 1. I have named the second job as Deploy-Project1. In the build section, select the add build and select Execute shell for running the commands on the shell.
In the shell, print the text with an echo command different from Job 1 then click on Apply and Save.

Step3 : Install necessary plugin for Build Pipeline.
In order to do this, first, go to Jenkins Dashboard >> Manage Jenkins.

- Advertisement -

Here, you will see various options to view Installed or Available plugins along with the update of installed plugins. Then, click on Available and search for Build pipeline in the plugin search box.


A list of all available plugins opens. In the search bar, search for Build Pipeline plugin in the list. Tick the Build Pipeline box and click on Install without restart.

Now, the Plugin will install. Once all the parameters are successfully installed, then click on the Jenkins dashboard or click on Restart Jenkins when installation is complete and no jobs are running. I clicked on Restart Jenkins when installation is complete and no jobs are running.

After clicking on Restart Jenkins when installation is complete and no jobs are running, you will be directed to Jenkins restarting page.


Once the restart is done, Jenkins Login page opens. Sign In by entering your Username and Password.


Step4 : Open the First Jenkins job and click on Configure to make changes in the job.

Click on Post-build Actions on the top menu and then click on Add Post-build action. Select Build other projects.


Under Build Other Projects, type the name of second Jenkins Job that was created in Step 2. Now, select Tigger only if the build is stable. (It will automatically run the second job after successful completion of the first one) Finally, click on Apply and Save.

Step5 : Add new Project as a Build Pipeline view.
For this click on the + icon as shown in the screenshot.

In the following step, enter the view name and select Build pipeline view. Proceed by clicking Ok.

jenkins pipeline
jenkins pipeline

You will be taken to the configuration page of the Build pipeline project, where you have to change the Upstream/downstream config with the name of your first Jenkins job name then click ok.

After clicking ok, you will get the Build pipeline page with multiple options :
Run; for running the pipeline.
History; for checking the history of your build pipeline project.
Configure; to edit your existing pipeline configuration or add any new parameter.
Add step; used to add the new Jenkins job in this Pipeline.
Delete; Simply, by clicking on it you can delete the Pipeline
Manage; it will redirect you to the Manage Jenkins page, where you will get all the settings of the Jenkins like System Configuration, Security, Status Information, Troubleshooting, and Tools and Actions.

The screen will show ongoing pipeline with different jenkins jobs. These can be differenciated with different colors:-
The jobs which are in running state are shown in yellow color.
All other pending jobs in the pipeline which are yet to start will be shown in blue color.
The successful completion of Jenkins jobs will be depicted with green color.
The failed jobs will be shown with red color.


Below, First job is in running state.

The screenshot shows that first job is succefully run.

Lastly, the output can be checked on the console.

If you want to learn how to install Jenkins check this post

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook