Jenkins is a DevOps tool that automates the creation, testing and delivery of software code. If you are new to Jenkins, this tutorial will help you understand how to create a Jenkins pipeline using one of the following methods:

  1. Classic Jenkins user interface
  2. Jenkins Blue Ocean user interface, which reduces clutter and improves information clarity.
  3. Pipeline script Jenkinsfile from SCM as Git repository

Method 1: Creating a Pipeline of the Classic Jenkins user interface

In the Jenkins menu, click the Create New Item button. Enter the name of your pipeline: Test lead. Select Pipeline from the list of options. Click on OK as shown below.

(Jenkins creates test pipeline)

After creating the test pipeline, edit it. Click on the Pipeline tab and paste the following code. This example code consists of three simple steps and the steps defined in each of them. For this simple example, there is an echo command in the Steps section that displays the message.

Pipeline {agentany stage (Stage 1: Web and DB integration) {stage {echo ‘1.1 Finding web application files’echo ‘1.2 Finding database files’echo ‘1.3 Combining web and DB files’}3 Combining web and DB files’}}Phase (‘Stage 2: Integration tests’) {stage {stage {echo ‘2.1 Run integration tests’}}}}}Phase (‘Stage 3: Release to Prod’) {stage {echo ‘3.1 Release code to production’}}}}

[Jenkins Pipeline Tab]

After selecting a pipeline, click on the Build Now button in the menu bar, which will make the pipeline work as shown below.

(Jenkins builds)

Once the piping is complete, you can view the logs using the Console Output menu item in the side menu bar, as shown in the figure below.

[Jenkins Console Edition]

Method 2: Creating a Pipeline of the Blue Ocean Interface

Blue Ocean offers Jenkins the best user experience. Designed from the ground up for the Jenkins pipeline, this user interface reduces clutter and increases interface transparency.

First search for Blue Ocean and install the Blue Ocean plugin via the Jenkins Plugin Manager . Restart Jenkins after installing the plugin.

Make sure you do this to keep your Jenkins and plugins up to date: To upgrade Jenkins to a new version and update plugins

Install a local Git repository on the Jenkins server to use Blueocean.

sudo-nyam setting git

cd /var/lib/jenkins
mkdir localgit
cd localgit
git clone https://my-git-repor-url/v1/repos/BinCode

Pay attention: I specified the path to the git repository in the form /var/lib/jenkins/localgit/BinCode

After installing the plugin, a new Open Blue Ocean menu item will appear in the sidebar, as shown below:

You can also access the blue ocean interface directly by adding /blue to the jenkins URL. Например:

[Jenkins Blue Ocean Menu]

The first time, Blue Ocean searches your local Git repository for the Jenkins file and runs a pipeline for each branch that contains a Jenkins file.

Since we haven’t created a Jenkins file yet, the user interface displays a prompt to create a new pipeline.

The pipeline construction interface guides you through the steps of creating a new pipeline. First click on the + next to the beginning. Click Add Step and select Print Message as shown below.

[Jenkins Blue Ocean Add Step]

After entering the message, click on the rear arrow in front of the scene name to go back. Don’t click Save yet.

Add another step – Print the message – 1.2 Retrieve files from the database – Click the arrow on the back of the scene name to go back.

Repeat the above steps for the echo of the third step, as shown below.

Jenkins Blue Ocean All Steps...

After creating the three steps, click Save to save the pipeline. You can validate your changes in the wizard or create a new branch. In this example, select the option Connect to a new agency and call it jenkins.

(Jenkins Blue Ocean New Git Branch)

Once the pipeline has been laid and executed, the status of each step is displayed. Click on a specific step name to see the corresponding output step, as shown below.

(Jenkins Blue Ocean View Stage Output)

On the Jenkins server you will see that a new branch named jenkins has now been created for your archive.

# git branch – a
* master
remotes/origing/HEAD -> origin/master

Method 3: Built with Jenkinsfile pipeline script from Git repository

First create a Jenkins file under your repository, as shown below. In this example I use the Jenkins file, which already exists in the industry. If you don’t have this file, create one.

# cd /var/lib/jenkins/localgit/BinCode

# git checkout jenkins
Passage to jenkins branch

# git-separation -a
* jenkins
remotes/origing/HEAD -> origin/master

# cat Jenkins file pipeline{agent any stage(‘Stage 1 : Web and DB Integration’) {stage {echo ‘1.1 Webapplication files get’echo’1.2 Get database files’3 Combine web and database files’}} stage (‘Stage 2: Integration tests’) {stage {echo ‘2.1 Run integration tests’}}} stage (‘Stage 3: Go live’) {stage {echo ‘3.1 Put code into production’}}}}.

First perform a step as described in method 1 to create a new pipeline of the classical user interface and give it a name: SCM test lead.

Then select SCM Test-Pipeline and under the Pipeline for Definition Pipeline Scenario tab of SCM as shown below. Make sure the script path is jenkinsfile, as shown below.

[Jenkins SCM script to create pipelines].

Information about your SCM repository will now also be available here. Enter your Git deposit details here. If your Jenkins file is for a specific branch, you must enter the name of that branch.

Learn how to create Jenkins references for Git here: Setting up the Git repository and references for jobs at Jenkins

Jenkins SCM file.

After you enter the details of the Git repository, start the pipeline. When the pipeline is complete, click the Exit Console button on the sidebar to display the pipeline progress log.

If you like this article, you can also…



jenkins pipeline script example,jenkins pipeline tutorial for beginners,jenkins pipeline plugin,jenkins replay pipeline,failed in branch jenkins,blue ocean replay stage,jenkins multibranch pipeline parameters,jenkins multibranch pipeline trigger,jenkins pipeline git branch parameter,jenkins pipeline vs multibranch pipeline,jenkins build specific branch,jenkins when ( branch pattern),jenkins scripted pipeline,jenkins pipeline example,jenkins pipeline variables,blue ocean automation,jenkins blue ocean test results,jenkins declarative pipeline examples github,jenkins blue ocean vs pipeline,jenkinsci/blueocean dockerfile,blue ocean jenkins dashboard,jenkins blue ocean not loading,jenkins blue ocean views,blue ocean build tool,jwt for blue ocean,common api for blue ocean,git pipeline for blue ocean,web for blue ocean,blueocean-dashboard,jenkins pipeline groovy tutorial,jenkins multibranch pipeline,jenkins declarative pipeline examples,jenkins multibranch pipeline environment variables list

You May Also Like

Fix: Messenger messages not delivered

There are many good alternatives to the most popular instant messaging on…

How to configure VLAN Trunking –

1. Mục đnch bai viết This article describes how to configure VLAN…

How to Cancel Comcast Service (Step-by-Step Procedure)

Comcast is the largest name in the telecommunications industry, supporting broadcast and…

How to choose the right .NET Software Development Company?

As a programmer, you will be using computers a lot, but the…