Reading Time: 2 mins.
Introduction:
In the previous articles of the same Jenkins series, you might have come across the Jenkins installation and how to build a basic job in Jenkins. As a continuation article, you will learn how to build and create a basic pipeline in Jenkins. As rightly pointed in the previous blog, build-action in Jenkins is restricted to a certain limit. You need to rely on plugins to overcome these challenges and thereby to extend the functionalities in Jenkins. Let’s start with the installation of the required plugins first, and later with Pipeline creation.
Haven’t built jobs in Jenkins yet, visit our blog post on How to Build and Create a Job in Jenkins
Installing Build Pipeline Plugin in Jenkins
Before you start creating the build pipeline in Jenkins, you need to install the pipeline plugins first.
Step 1: Installing Plugins
To overlook the plugin settings, go to Manage Jenkins>>Manage Plugins.
In case the plugin has been installed already, it will be seen under the Installed tab.
Note: If the plugins haven’t been installed already, it can be done so under the Available tab.
Step 2: Creating Jenkins Pipeline
Login into your Jenkins dashboard and select the “+” button on the top left-side of the panel to create your Jenkins pipeline.
Next, provide a name for your pipeline in the View Name. Select Build Pipeline View and click OK.
Post which you need to provide some other information about your Jenkins pipeline. It is recommended to accept the default settings and select the First Job under the settings.
Upon completion, click Apply and OK.
The below screenshot is the sample view of your build pipeline.
Step 3: Running the Build Pipeline:
To run your pipeline build, go to your First Job and select Configure to chain your jobs.
Under Build Trigger, select Build after other projects are built and tweak other necessary settings to create a chain for all your jobs.
Note: If you haven’t installed your Build Pipeline View plugin yet, make sure that you do it now.
Now, go to your Jenkins dashboard and select the “+” button to create a view. Soon after also select the Build Pipeline View and tap OK.
Go to Pipeline view configuration and find Pipeline Flow to choose the initial job run that has the chains to other jobs.
For example, here, we have selected the Demo as the initial job that is chained to other jobs. Now, all the jobs start running one by one in the pipeline.
While the pipeline is running, the status of the pipeline can be confirmed via the Red and Green symbols. Red denotes the fail status of the build and the green denotes the successful execution of the build.
Step 4: Running the Jenkins pipeline
Upon clicking the Run option in the Jenkins pipeline, you will get to see a screen like the below one.
An example of running a basic pipeline.
Final Words:
Thus, this is how you run a simple build pipeline in Jenkins and a demo view of running a basic pipeline has also been shown. Overall you learnt about how to build a job and eventually the build pipeline creation in Jenkins. In the creation of pipeline creation, you went through installing of plugins, creating of build pipeline, running of the build pipeline and subsequently, the running of Jenkins pipeline.