A Brief Introduction to Jenkins and Pipeline


This guide is to briefly introduce the a DevOps concept that is used heavily in almost every company - pipline. I won’t be going into the nitty gritty of what Jenkins and Pipelines can and cannot do. I’m nowhere near an expert or have personally used Jenkins or built a pipline myself. I’m here to educate myself as well as others that want a small introduction to an important concept.

What is Jenkins?

Jenkins is a self-contained, open source automation server that helps build, test, and deploy any project. To under what Jenkins is capable of doing we need to understand the concepts around Coninuous Integration / Continuous Delivery - CI/CD for short.

What is a Pipeline?

The first concept we’ll introduce is pipelines. A pipeline refers to groups of events or jobs that connect together in sequence. Two familiar concepts that formulate a pipline:


Building a simple Jenkins pipeline

This part assumes you already downloaded and successfully installed Jenkins. Jenkins welcome Upon successfully installating Jenkins, you should see this page. As stated above - “a pipline refers to a job that connect together a sequence”. We are going to Create new jobs

Here we will name the job TestPipeline, but you can name it whatever is suitable for the pipeline. testpipeline

After filling out your pipeline name and selecting Pipeline, we can begin creating a Pipeline script that can run the Stages and Steps of our project.

The Pipeline syntax is used to define all the work done throughout our TestPipeline. Pipeline script

Below is the entire Pipeline script.

In this Jenkinsfile we have 3 Stages (Build, Test, Deply). Each stage will have step(s) printing out what is happening that can be easily identifiable by the console to see exactly what is happening.

pipeline {
    agent any
    stages {
    	stage('Build') {
            steps {
                echo 'Building...'
                echo "Running ${env.BUILD_ID} ${env.BUILD_DISPLAY_NAME} \
                 on ${env.NODE_NAME} and JOB ${env.JOB_NAME}"
        stage('Test') {
            steps {
                echo 'Testing...'
        stage('Deploy') {
        	steps {
       			echo 'Deploying...'

Note I know that I haven’t talked about what a Jenkinsfile is, but I will be doing that in a future guide where I will go more in depth about it.

After we save the Pipeline script, we can now Build now tab to build our TestPipeline pipeline and see if our pipeline builds successfully. Pipeline build

Finally, we can see that from the Console Output tab that our pipeline built successfully. Pipeline success

# Running 1 #1 on master and JOB TestPipeline
echo "Running ${env.BUILD_ID} ${env.BUILD_DISPLAY_NAME} /
  on ${env.NODE_NAME} and JOB ${env.JOB_NAME}"

In the Console Output, we can see that it matches our Build Stage echo command, that we created in the Pipeline script (Jenkinsfile).


There you have it, this was a brief introduction to Jenkins and Pipelines. Next I will be going into more of the capabilities of Jenkins and Piplines and automate the CI/CD of a Python web application project.