Skip to main content

Jenkins Pipelines


Intro Video

Photo of Michael McClaren

Michael McClaren

Linux Training Architect I in Content

Michael was always the guy that fixed the computers in his family, and eventually decided he wanted to prove he had the chops to become a true IT professional. He had worked as a master mechanic and was tired of turning wrenches every day. After his first certification, an MCSE in server 2003, doors started opening. He then proceeded to work as an entry-level sysadmin, and eventually found his way to Linux Academy. He credits one certification as making the difference and changing his life for the better.







Hands-on Labs


Course Details

In this course, we will be looking at Jenkins pipelines. We will begin with the basics of pipelines, and the difference between a declarative pipeline and a scripted pipeline. We will work with Source Code Management and Jenkinsfiles to automate our pipelines, and we will see how to use Docker to take our pipelines to the next level.


Getting Started

About the Author


Lesson Description:

I wanted to give you a bit about my background and the things that have led me to believe in CI/CD and infrastructure as code. I have been a systems architect, AWS DevOps engineer, release manager, and corporate trainer. Thank you for letting me be a part of your learning journey.

What We Will Be Covering


Lesson Description:

In this video, we will take a high-level view of what this course covers. We will start with simple pipeline projects in the old Graphical User Interface (GUI) and then take a look at Blue Ocean. From there, we will get into Jenkins files, and how they are structured and used to configure jobs, we will look at the parts that make up a pipeline, and we will finish it off by using docker containers as build agents and creating a full deployment pipeline.

What Is a Pipeline?

Pipeline Jobs


Lesson Description:

In this lesson, we will be learning how to use the Jenkins pipeline job type in the Graphical User Interface (GUI) to help us create a pipeline script. We will also be using a job that we built in the Jenkins Fundamentals course as an example to show how project as code looks in actual usage.

The Blue Ocean Editor


Lesson Description:

In this lesson, we will be taking a look at the Blue Ocean graphical pipeline editor. This is a collection of plugins intended to provide a graphical interface that allows you to visualize your pipeline. As of the recording of this lesson, there was an issue with a plugin that affected the ability of Blue Ocean to connect to GitHub. In this lesson, I will show you how to downgrade the plugin to get Blue Ocean working again. I expect this issue to be resolved soon but I wanted to take the opportunity to show how plugin downgrades are done.

Scripted vs. Declarative Pipelines

Scripted Pipelines


Lesson Description:

In this lesson, we will be looking at scripted pipelines. This type of pipeline uses Groovy scripts to perform its tasks. This is considered an imperative pipeline, as the steps are provided for how to do the task. That is in contrast to a declarative pipeline, which describes what is to be done.

Declarative Pipelines


Lesson Description:

In this lesson, we will look at a declarative pipeline and compare it against a scripted pipeline from the last lesson. We will also discuss some of the limitations and advantages of each.

Groovy and DSL


Lesson Description:

In this lesson, we will be looking at both the Domain Specific Language (DSL), and Groovy scripting language, which are the languages used for defining pipelines in Jenkins. DSL, which came later than Groovy, is meant to be easier to read and, therefore, easier to use for creating pipelines. It is more restrictive, as it provides declarations that are allowed, and those declarations might not fit every configuration need that might come up in a build. Groovy is a fully-featured scripting language meant to be used with Java. It also uses some of the same language syntaxes as Java. It allows almost all features of the language to run, and, by default, Groovy scripts run in the Groovy sandbox, which is put in place to prevent malicious code from being run. We will explore this in the lesson as well.

Automating Pipelines

Jenkins File Basics


Lesson Description:

In this lesson, we will take a look at the basics of a Jenkins file. We will see how to create a Jenkins file and the sections that make up the file. These files are used by Jenkins to configure jobs via the code that they contain. This allows us to version build processes by storing the configuration as code in the same repository as the code that is being built.

Pipeline Triggers


Lesson Description:

In this lesson, we will be taking a simple pipeline and adding triggers. We will see how to create a webhook in the graphical interface, as well as how we can use the triggers directive in the Jenkinsfile to schedule polling for the job. As we continue to work with simple pipelines, we are adding the building blocks for more advanced operations.

Multibranch Pipelines


Lesson Description:

In this lesson, we will look at how a multibranch pipeline can be used to automate builds when there is more than one branch in a project. This is especially useful for standardizing builds when you have preproduction and production branches. Additionally, we will look at automating these builds using code in the Jenkinsfile.

Advanced Jenkinsfiles

Global Libraries


Lesson Description:

In this lesson, we will be looking at Global libraries and Shared libraries. We will see how to scope a library and the reasons why you should be using folder level libraries.

Variables and Credentials


Lesson Description:

In this lesson, we will be looking at Variables and Credentials in Jenkins Pipeline. We will look at the scope of variables and see that where the variable is declared is important. Then we will see how to create and utilize credentials in our pipeline and see that Jenkins obfuscates the secrets in the pipeline as well as the logs and Jenkinsfiles.



Lesson Description:

In this lesson, we will be extending pipelines using docker, and we will see how docker can be used as a build agent and how artifacts from those agents can be used in other jobs. We will be looking at some simple examples as well as completing a full deployment by using a docker file to build a project and then using a deployment pipeline to deploy the build artifact into a production environment.

Closing Thoughts

Learning More About Jenkins and Pipelines


Lesson Description:

This video is a quick guide to the Jenkins documentation. There are some places that refer to the Jenkins Handbook, and I want you to know how to locate that resource. I also talk about the other items that are on the pipeline syntax page so that if you need to go deeper into a topic than I was able to in this course, you have some direction on where to locate that knowledge.

How to Find More DevOps Courses


Lesson Description:

In this last video, I share with you how to search for courses on the site. I also talk about some of the courses that I feel are a major benefit to a DevOps journey and also re-enforce the ideas behind CI/CD and Jenkins methodology. I appreciate you taking this journey with me, and it is my sincere hope that you keep on learning.

Take this course and learn a new skill today.

Transform your learning with our all access plan.

Start 7-Day Free Trial