Jenkins Tutorial For Beginners: 21+ Practical Guides

Jenkins tutorial for beginners

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.

  1. Continuous Integration: With Jenkins pipelines, we can achieve CI for both applications and infrastructure as code.
  2. Continuous Delivery: You can set up well-defined and automated application delivery workflows with Jenkins pipelines.
  3. 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.

  1. 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.
  2. Jenkins High Availability: This guide will cover key concepts in setting up a Highly available Jenkins using the open-source version.

Jenkins Administration Tutorials

  1. Installing and configuring Jenkins: Learn to install and configure Jenkins on Ubuntu VM & Docker container.
  2. Install and Configure Jenkins on Centos/Redhat: This tutorial helps you set up Jenkins on RedHat-based Linux distributions.
  3. Setting up Jenkins Agents: This tutorial will teach you how to configure Jenkins master and agents using both SSH and JNLP methods.
  4. Configure SSL on Jenkins Server: This tutorial will walk you through the process of setting up SSL for the Jenkins controller.
  5. 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.
  6. Backing up Jenkins Data and Configurations
  7. Setting up Custom UI for Jenkins: A tutorial to change the default UI of Jenkins with custom CSS.
  8. Setting up Jenkins Master on Kubernetes Cluster: Tutorial to set up Jenkins infrastructure on containers.
  9. 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

  1. Configuring Docker Containers as Jenkins Build Agents
  2. Scaling Jenkins Agents with Kubernetes
  3. Configuring ECS as Build Slave For Jenkins [Needs Update]

Jenkins Pipeline Tutorials

  1. 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.
  2. 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.
  3. Creating Jenkins Shared Library: Step-by-step guide on the practical implementation of Jenkins shared library
  4. 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

  1. Java Continuous Integration with Jenkins: This tutorial teaches you to set up a Java CI pipeline using the maven build utility. [Needs Update]
  2. Jenkins PR based builds with Github Pull Request Builder Plugin
  3. Jenkins Multi-branch Pipeline Detailed Guide for Beginners
  4. Building Docker Images Using Kaniko & Jenkins on Kubernetes
  5. How to manage Secrets with Jenkins [Upcomming]
  6. How to Build Docker Image using Jenkins [Upcomming]
  7. How to Build Java Applications Using Jenkins Pipeline [Upcomming]

Jenkins Core Features

Let’s have look at the overview of key Jenkins 2.X features that you should know.

  1. Pipeline as Code
  2. Shared Libraries
  3. Better UI and UX
  4. 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.

  1. Scripted Pipeline and
  2. 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 blue ocean

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.

  1. The common pipeline shared library code resides on a version control system like Github.
  2. The shared library GitHub repo needs to be configured in Jenkins global configuration. It enables access to the library for all Jenkins jobs.
  3. 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.

  1. GitOps-based Tekton pipelines
  2. Environment Promotion via GitOps
  3. Pull Request Preview Environments
  4. 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
  1. 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.

  2. 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!

    1. Hi, Glad my content is helpful.

      You are correct. It should be Github. I have made the changes. Thanks for letting me know.

  3. Hi, it’s really a great resource to understand jenkins better.
    Could you please make a tutorial explaining crumbs concept please

  4. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like