In this Jenkins tutorial series, you will learn all the essential topics for a DevOps engineer to understand Jenkins better with step-by-step practical tutorials.
What is Jenkins?
Jenkins is a continuous open-source integration written in Java. It was forked from Hudson Project after a dispute with Oracle. Since the fork, Jenkins has grown to be much more than a continuous integration solution.
Jenkins is not just a Continuous Integration tool anymore. Instead, it is a Continuous Integration and Continuous delivery tool. You can orchestrate application deployments using Jenkins with a wide range of freely available community plugins and native Jenkins workflows.
Jenkins also supports GitOps workflows with Jenkins X. It helps you accelerate the continuous delivery pipeline on Kubernetes.
Jenkins Use Cases
The following are the main Jenkins use cases from my experience extensively working on Jenkins.
- Continuous Integration: With Jenkins pipelines, we can achieve CI for both applications and infrastructure as code.
- Continuous Delivery: You can set up well-defined and automated application delivery workflows with Jenkins pipelines.
- Automation & Ad-Hoc Tasks: With Jenkins jobs and pipelines, you can automate infrastructure components and perform ad-hoc infrastructure tasks (Backups, remote executions, etc.).
Jenkins Tutorials For Beginners
In this collection of Jenkins tutorial posts, I will cover various Jenkins guides, which will help beginners get started with many of the Jenkins core functionalities.
I have categorized the list of Jenkins beginner tutorials into multiple sections. From Jenkins installation to advanced concepts like shared libraries are covered in this tutorial list.
It is a growing list of Jenkins step-by-step guides. I will add all the latest tutorials to this list.
How Does Jenkins Work?
In this section, you will learn the very basics of Jenkins that every beginner should know. Overall you will learn how Jenkins works as a CI/CD tool.
- Jenkins Architecture Explained for Beginners: In this tutorial, you will learn how Jenkins works, its core components, how Jenkins data is organized, and the protocols involved in Jenkins controller-agent communication.
- Jenkins High Availability: This guide will cover key concepts in setting up a Highly available Jenkins using the open-source version.
Jenkins Administration Tutorials
- Installing and configuring Jenkins: Learn to install and configure Jenkins on Ubuntu VM & Docker container.
- Install and Configure Jenkins on Centos/Redhat: This tutorial helps you set up Jenkins on RedHat-based Linux distributions.
- Setting up Jenkins Agents: This tutorial will teach you how to configure Jenkins master and agents using both SSH and JNLP methods.
- Configure SSL on Jenkins Server: This tutorial will walk you through the process of setting up SSL for the Jenkins controller.
- Running Jenkins on port 80: By default Jenkins runs on port 8080. This guide has step by step guides to setup Jenkins to run on port 80.
- Backing up Jenkins Data and Configurations
- Setting up Custom UI for Jenkins: A tutorial to change the default UI of Jenkins with custom CSS.
- Setting up Jenkins Master on Kubernetes Cluster: Tutorial to set up Jenkins infrastructure on containers.
- Jenkins Setup Using AWS Autoscaling Group: This tutorial teaches you to automate the whole Jenkins setup on AWS using an Autoscaling group, EFS, and a load balancer.
Scaling Jenkins Agents
- Configuring Docker Containers as Jenkins Build Agents
- Scaling Jenkins Agents with Kubernetes
- Configuring ECS as Build Slave For Jenkins [Needs Update]
Jenkins Pipeline Tutorials
- Jenkins Pipeline as Code Tutorial for Beginners: In this guide, you will learn about Jenkins Pipeline as code. Jenkins pipeline as code helps you organize and manage all the CI/CD Jenkins pipeline as code. This tutorial walks you through the important pipeline concepts.
- Getting Started With Jenkins Shared Libary: Shared library is a very important concept in Jenkins. It helps you to create reusable pipeline code. It is a must-learn concept.
- Creating Jenkins Shared Library: Step-by-step guide on the practical implementation of Jenkins shared library
- Beginner Guide to Parameters in Declarative Pipeline: In this tutorial, you will learn to manage static and dynamic Jenkins parameters using the pipeline as code.
Jenkins CI/CD Tutorials
- Java Continuous Integration with Jenkins: This tutorial teaches you to set up a Java CI pipeline using the maven build utility. [Needs Update]
- Jenkins PR based builds with Github Pull Request Builder Plugin
- Jenkins Multi-branch Pipeline Detailed Guide for Beginners
- Building Docker Images Using Kaniko & Jenkins on Kubernetes
- Sending Email Notification for CI Builds
- How to manage Secrets with Jenkins
- How to Build Docker Image using Jenkins
- How to Build Java Applications Using Jenkins Pipeline
Jenkins Core Features
Let’s have look at the overview of key Jenkins 2.X features that you should know.
- Pipeline as Code
- Shared Libraries
- Better UI and UX
- Improvements in security and plugins
Pipeline as Code
Jenkins introduced a DSL by which you can version your build, test, and deploy pipelines as code. Pipeline code is wrapped around a groovy script that is easy to write and manage. An example pipeline code is shown below.
node(‘linux’){ git url: 'https://github.com/devopscube/simple-maven-pet-clinic-app.git' def mvnHome = tool 'M2' env.PATH = "${MNHOME}/bin:${env.PATH}" sh 'mvn -B clean verify' }
Using pipeline as a code you can run parallel builds on a single job on different slaves. Also, you have good programmatic control over how and what each Jenkins job should do.
Jenkinsfile is the best way to implement Pipeline as code. There are two types of pipeline as code.
- Scripted Pipeline and
- Declarative Pipeline.
I recommend using only a declarative pipeline for all your Jenkins-based CI/CD workflows, as you will have more control and customization over your pipelines.
Jenkins 2.0 has a better User interface. The pipeline design is also great in that the whole flow is visualized. Now you can configure the user, password, and plugins right from the moment you start the Jenkins instance through awesome UI.
Also, Jenkins Blueocean is a great plugin that gives a great view of pipeline jobs. You can even create a pipeline using the blue ocean visual pipeline editor. Blueocen looks like the following.
Jenkins Shared Libraries
Jenkins shared library is a great way to reuse the pipeline code. You can create your CI/CD code libraries, which can be referenced in your pipeline script. In addition, the extended shared libraries will allow you to write custom groovy code for more flexibility.
Here is how shared libraries work.
- The common pipeline shared library code resides on a version control system like Github.
- The shared library GitHub repo needs to be configured in Jenkins global configuration. It enables access to the library for all Jenkins jobs.
- You have to add an import statement to import the shared libraries and use it in the pipeline code in individual jobs. During job builds, first, the shared library files get checked out.
GitOps With Jenkins X
Jenkins X is a project from Jenkins for CI/CD on Kubernetes. This project is entirely different from normal Jenkins.
Jenkins X has the following key features.
- GitOps-based Tekton pipelines
- Environment Promotion via GitOps
- Pull Request Preview Environments
- Feedback and chat on Issues and Pull Requests
Conclusion
All the Jenkins tutorials mentioned in this article will help you take your Jenkins knowledge to the next level.
Jenkins has a huge community and, you can find support in different forums if you face any issues.
If you think any tutorial is missing, do let me know in the comment section. We will add it to the list.
Also, if you want to learn real-world Jenkins uses cases, you can try out the Jenkins workflows from the DevOps Projects.
9 comments
Thank you
Awesome tutorials! I wish you had some examples of using Jenkins for PHP CICD Pipelines. Those are a little hard to come by on the internet.
thanks so much Bibin , its very useful
Hi Bibin,
Great work! Appreciate your contribution to the DevOps and Learning community.
I just noticed you have mentioned the following in the “Jenkins Shared Libraries” section.
– “The common pipeline shared library code is hosted on a version control system like **Jenkins**” Shouldn’t that be **Github**
I am new to DevOps… pls correct me if I am wrong, and pls feel free to delete this comment. Thanks!
Hi, Glad my content is helpful.
You are correct. It should be Github. I have made the changes. Thanks for letting me know.
Thank you very much sir and make more tutorials on DevOps related
Hi, it’s really a great resource to understand jenkins better.
Could you please make a tutorial explaining crumbs concept please
Recently was asked to build an auto-deployment system for our project using Jenkins
and I didn’t know what Jenkins was.
Now I see this tutorials.
Thank you.
Very useful