Industry use cases of Jenkins

Harshal Thakare
15 min readMar 13, 2021

Build great things at any scale

Hello everyone,🙋‍♂️🙋‍♂️

In this article, We are going to Research for industry use cases of Jenkins

What is Jenkins ?

Jenkins is an open-source server that is written entirely in Java. It lets you execute a series of actions to achieve the continuous integration process, that too in an automated fashion.

This CI server runs in servlet containers such as Apache Tomcat. Jenkins facilitates continuous integration and continuous delivery in software projects by automating parts related to build, test, and deployment. This makes it easy for developers to continuously work on the betterment of the product by integrating changes to the project.

Jenkins automates the software builds in a continuous manner and lets the developers know about the errors at an early stage. A strong Jenkins community is one of the prime reasons for its popularity. Jenkins is not only extensible but also has a thriving plugin ecosystem.

Some of the possible steps that can be performed using Jenkins are:

  • Software build using build systems such as Gradle, Maven, and more.
  • Automation testing using test frameworks such as Nose2, PyTest, Robot, Selenium, and more.
  • Execute test scripts (using Windows terminal, Linux shell, etc.
  • Achieve test results and perform post actions such as printing test reports, and more.
  • Execute test scenarios against different input combinations for obtaining improved test coverage.
  • Continuous Integration (CI) where the artifacts are automatically created and tested. This aids in identification of issues in the product at an early stage of development.

At the time of what is Jenkins blog, it had close to 1500+ plugins contributed by the community. Plugins help in customizing the experience with Jenkins, along with providing support for accelerating activities related to building, deploying, and automating a project.

History Of Jenkins

Jenkins has an early mover advantage since it has been in development since 2011. Kohsuke Kawaguchi created Jenkins (then called ‘Hudson’) while working at Sun Microsystems. Hudson was created in summer 2004 and the first release was in February 2005.

After the acquisition of Sun Microsystems by Oracle, a proposal was approved by the Hudson community for creating the Jenkins project. In February 2011, Oracle intended that the development of Hudson should continue hence, Hudson was forked instead of renaming it to Jenkins.

Though Hudson and Jenkins were being developed independently, Jenkins acquired significantly more projects & contributors than Hudson. Consequently, Hudson is no longer maintained by the community.

Jenkins Release Cycle

Like other open-source projects, Jenkins also produces two release lines — LTS (Long-Term Support) and Weekly (regular) releases. Jenkins is very good with releases, as stable releases happen every four weeks.

At the time of this ‘, what is Jenkins’ article, the latest version of Jenkins LTS was 2.235.2 and Jenkins Weekly was 2.249.

Salient Features Of Jenkins

Jenkins is more functionality-driven rather than UI-driven hence, there is a learning curve involved in getting to know what is Jenkins. Here are the powerful developer-centric features offered by Jenkins:

Continuous Integration and Continuous Delivery

As an extensible automation server, Jenkins can be used as a simple CI server or turned into the continuous delivery hub for any project.

Easy installation

Jenkins is a self-contained Java-based program, ready to run out-of-the-box, with packages for Windows, Linux, macOS and other Unix-like operating systems.

Easy configuration

Jenkins can be easily set up and configured via its web interface, which includes on-the-fly error checks and built-in help.

Open-Source

As it is open-source, it is free for use. There is a strong involvement of the community which makes it a powerful CI/CD tool. You can take support from the Jenkins community, whether it is for extensibility, support, documentation, or any other feature related to Jenkins.

Plugins

With hundreds of plugins in the Update Center, Jenkins integrates with practically every tool in the continuous integration and continuous delivery toolchain.

Extensible

Jenkins can be extended via its plugin architecture, providing nearly infinite possibilities for what Jenkins can do.

Easily Distributed

Jenkins can easily distribute work across multiple machines, helping drive builds, tests and deployments across multiple platforms faster.

How Does Jenkins Work?

In this section of the What is Jenkins blog, we look at the internal functioning of Jenkins i.e. what happens once the developer commits changes to the repository and how CI/CD is realized in Jenkins. We also look at the Master-Agent architecture in Jenkins.

Architecture Of Jenkins

Before we dive into how does Jenkins work, we must understand the architecture of Jenkins. These are the series of steps that outlines the interaction between different elements in Jenkins:

  • Developers do the necessary modifications in the source code and commit the changes to the repository. A new version of that file will be created in the version control system that is used for maintaining the repository of source code.
  • The repository is continuously checked by Jenkins CI server for any changes (either in the form of code or libraries) and changes are pulled by the server.
  • In the next step, we ensure that the build with the ‘pulled changes’ is going through or not. The Build server performs a build with the code and an executable is generated if the build process is successful. In case of a build failure, an automated email with a link to build logs and other build artifacts is sent to the developer.
  • In case of a successful build, the built application (or executable) is deployed to the test server. This step helps in realizing continuous testing where the newly built executable goes through a series of automated tests. Developers are alerted in case the changes have caused any breakage in functionality.
  • If there are no build, integration, and testing issues with the checked-in code, the changes and tested application are automatically deployed to the Prod/Production server.

Here is the diagrammatic representation of the Jenkins architecture:

A single Jenkins server might not be sufficient to realize the following requirements:

  • Testing needs to be performed on different environments (i.e. code written using different languages e.g. Java, Python, C, etc. are committed to the version control system), where a single server might not suffice the requirement.
  • A single Jenkins server might not be sufficient to handle the load that comes with large-scale software projects.

In such scenarios, the distributed (or Master-Agent) architecture of Jenkins is used for continuous integration and testing. Diving deeper into how does Jenkins works, we take a look at the architecture of Jenkins.

Master- Agent Architecture In Jenkins

The master-agent (or distributed) architecture in Jenkins is used for managing distributed builds. The Master and Agent(s) communicate through the TCP/IP protocol.

These are the roles and responsibilities of the Jenkins Master and Agent(s):

Jenkins Master

The main server in Jenkins is the Master. Here are the jobs handled by Jenkins Master:

  • Schedule build jobs
  • Choosing the appropriate agent in the master-agent ecosystem for dispatching the builds.
  • Monitor agents and take them online/offline as and when required.
  • Presenting the build results (and reports) to the developer.

The Jenkins master can also execute the jobs directly but it is always recommended to select the appropriate agent(s) for build and execution-related tasks.

Jenkins Agent(s)

A agent is a remote machine that is connected to the Master. Depending on the project and build requirements, you could opt for ’N’ number of agents. agents can run on different operating systems and depending on the ‘type of build request’, the appropriate Agent is chosen by the Master for build execution and testing.

Here are the jobs handled by the Jenkins Agent(s):

  • Listen to commands from the Jenkins Master.
  • Execute build jobs that are dispatched by the Master.
  • Developers have the flexibility to run the build and execute tests on a particular agent or a particular type of Agent. The default option is Jenkins Master selecting the best-suited Agent for the job.

Here is a simple diagrammatic representation of how does Jenkins work, with multiple Jenkins Agents connected to the Jenkins Master:

How Does Jenkins Work In Master-Agent Architecture?

In the previous section of the What is Jenkins blog, we touched upon the brief responsibilities of Master and Agent(s) in Jenkins. Let’s look at exactly how does Jenkins works in the Master-Agent (or distributed) architecture:

In the Jenkins Master-Agent architecture shown below, there are three Agents, each running on a different operating system (i.e. Windows 10, Linux, and Mac OS).

  • Developers check-in their respective code changes in ‘The Remote Source Code Repository’ that is depicted on the left-hand side.
  • Only the Jenkins master is connected to the repository and it checks for code-changes (in the repository) at periodic intervals. All the Jenkins Agents are connected to the Jenkins Master.
  • Jenkins master dispatches the request (for build and test) to the appropriate Jenkins Agent depending on the environment required for performing the build. This lets you perform builds and execute tests in different environments across the entire architecture.
  • The Agent performs the testing, generates test reports, and sends the same to the Jenkins Master for monitoring.

As developers keep pushing code, Jenkins Agents can run different builds versions of the code for different platforms. Jenkins Master (or Master Node) controls how the respective builds should operate.

In subsequent sections of the What is Jenkins blog, we would look at the steps for setting up Jenkins Master and Agents.

How To Install Jenkins?

In this section of What is Jenkins blog, we will show you how to install Jenkins on Windows 10. Jenkins is available for download for other operating systems like different flavors of Unix (e.g. UBuntu, Gentoo, FreeBSD, etc.), as well as Mac OS. You can also put Jenkins in the Docker Container. Please visit https://www.jenkins.io/download/ to download the required Jenkins installer.

Jenkins installer is also available as a generic Java Package (.war). If you are using Jenkins with Selenium for performing cross browser testing, we recommend using the .war file, as you can witness the execution of the test scenarios with automated tests executing on browsers in the non-headless mode.

Prerequisites For Jenkins Installation

  1. If JDK (Java SE Development Kit) is not present on the machine, download JDK 8 as per the configuration of your system (i.e. 32-bit or 64-bit). At the time of this article, the latest version of JDK for Windows was jdk-8u261-windows*.
  2. Add the JDK installation path in the System Environment variable. This also needs to be done for JRE (Java Runtime Environment).
  3. Add environment variable JAVA_HOME pointing to the location where JDK 8 is installed.

What Is Jenkins Pipeline?

Pipeline in Jenkins is a group of jobs (or events) that are interlinked in a particular sequence. Jenkins Pipeline is a set or suite of plugins that provides support for implementation and integration of Continuous Delivery pipelines into Jenkins.

The Pipeline also provides a set of tools that are useful for modeling simple as well as complex delivery pipelines ‘as code’ through ‘Pipeline Domain-Specific Language (DSL)’ syntax.

Every job in the Jenkins pipeline has some dependency on one or more events. Continuous delivery pipeline in Jenkins consists of four states — Build, Deploy, Test, and Release. Each of these states consist of events that execute in a sequence.

What Is Jenkinsfile?

Now that you understand what is Jenkins pipeline, we can dive deeper into the concept. The entire definition of a Jenkins Pipeline is written into a text file called Jenkinsfile. It contains the steps required for running a Jenkins Pipeline. ‘Pipeline as code’ can be implemented using Jenkinsfile and Domain Specific Language (DSL) is used for defining the same.

Jenkinsfile can also be committed to the source control repository of the project. With Jenkinsfile, the CD Pipeline is also treated as a part of the application that is versioned, committed, and reviewed like any other piece of code.

Some of the major benefits of Jenkinsfile are:

  • Single Jenkinsfile can be used for creating a Pipeline build process for all the branches and executing pull requests.
  • The implementation in a Pipeline can be reviewed like normal source code.
  • Audit trail of the Pipeline.
  • Singular source for the Pipeline can be viewed as well as edited by multiple members associated with the project.

Though Pipeline can be defined either in web UI or with a Jenkinsfile, it is recommended to define the what is Jenkins Pipeline in a Jenkinsfile and maintain the same in a source control repository.

Syntax For Defining A Jenkinsfile

To define what is Jenkins pipeline, Jenkinsfile can be written using the following types of Syntax:

a. Declarative

Declarative Pipeline is a recent feature of Jenkins Pipeline that makes reading and writing the Pipeline code a lot easier. Unlike Scripted Syntax with Pipelines, Declarative Syntax helps in controlling different aspects of the Pipeline in a simplistic manner.

b. Scripted

Scripted Pipeline is a more traditional way of writing a Jenkins Pipeline as code. It uses traditional Groovy-based syntax. The Web UI of Jenkins is normally used for writing the Scripted Pipeline in a Jenkinsfile.

Important Concepts Of Jenkins Pipeline

Moving on with what is Jenkins pipeline, here are some basic concepts that need to be well-understood if you are planning to use the Jenkins Pipeline:

a. Pipeline

The Pipeline consists of a set of instructions written as code. It defines the entire build process, which ideally consists of different stages for building, testing, and delivering the application.

b. Node

Node is a machine that is a part of the Jenkins environment. The Jenkins Pipeline executes on a node block that is usually a part of the Scripted Pipeline syntax.

c. Stage

Stage in a Jenkins Pipeline consists of a unique subset of tasks such as Build, Test, Deploy, etc. The Stage block is used by many plugins for providing the visualization of Jenkins status (and progress).

d. Step

Step is a single task that tells Jenkins what exactly needs to be done. For example, setting an environment variable can be done in a step, executing a build command can also be a step. On the whole, a Jenkins Pipeline constitutes a series of steps.

Advantages Of Using Jenkins Pipeline

Jenkins Pipeline is instrumental in adding a rich set of automation tools onto Jenkins. Hence, Jenkins can be used for simple continuous integration as well as for comprehensive CD pipelines.

These are some of the primary reasons for using the Jenkins Pipeline:

  • As the Jenkins Pipeline is implemented as code, it can be checked in the source control repository. Teams can view, edit, as well as iterate upon the delivery pipeline.
  • Jenkins Pipelines are robust. A Pipeline is automatically resumed in case the server witnesses an unplanned restart.
  • Pipeline process can pause and wait for input for any input from the user.
  • Pipelines are versatile as they can be used for realizing complex CD requirements, including performing work in parallel.
  • Jenkins Pipelines are extensible by plugin developers and users with Pipeline Shared Libraries.

Shortcomings Of Jenkins

Jenkins also its own share of shortcomings (not necessarily disadvantages). These are some of the major shortcomings of Jenkins:

  • As a product, Jenkins is more ‘feature’ driven and ‘developer’ centric. Users who are obsessed with user interfaces may have to go through a learning curve to use Jenkins.
  • Setting changes (including plugin installations) might result in issues such as Jenkins not starting up, etc. In such scenarios, you have to search online for a solution and fortunately you would find one as Jenkins has a large user-base!

Overall, Jenkins is a powerful CI/CD tool that is truly built for developers!

Jenkins Case Study: Avoris Travel

Speed matters when your mission is to reinvent the travel business: for your agents, your customers, and, especially, your technology team. That’s the case for Ávoris Travel, part of Barceló Group, which boasts an extensive network of almost 675 travel agencies across Spain and Portugal. The company provides unique brand holidays, leisure and business travel and offers reviews and advice on hotels, flight deals and tickets, cruise deals, and rental car services to more than 1.5 million international travelers.

With distinguished destination travel brands like LeSki, Le Musik, and a selection of author travels under its “Viagens Com Assinatura” signature travel concept, a proprietary database is the ticket to securing inventive travel opportunities. From their corporate travel agency, BCD Travel, which supports more than 4,000 clients to their Rhodasol & BedToYou brand which features a bank of hotel beds open to all agencies with more than 100,000 establishments, a smart dynamic booking engine is essential.

And all of these brands (plus more!) are powered by a nimble, progressive technology team. Not only do their developers and engineers need to support all of the various front-end applications relied on by their agents, their backend services need to maintain and enhance an unparalleled search database to power this innovative operation. Unique to Avoris is a discreet machining technology which enables agents to enter specific criteria to search and find all types of trips and travel opportunities across the entire network.

Because of this, the technologists at Avoris need to constantly innovate to support Avoris global brands, agents, and more. To power accelerated development activities, all of those divisions are supported by a CI/CD platform built on Jenkins.

A fast, simple CI/CD matters when your technology is
the driver for a new kind of travel company

“Our infrastructure is very important because we have to be online to meet customer demand anywhere in the world,” said Alejandro Alvarez Vazquez, Sysadmin, Avoris Travel. “Our CI/CD platform is used by 200 people. The services that we build and deploy are used by thousands of potential clients and by our network of 675 own agencies located in Spain and Portugal.”

As noted, Avoris engineers have created their own search and booking engines fueled by a proprietary business rules engine. As their developers innovate these technologies, having a solid CI/CD that lets them work at an accelerated pace is critical.

“Our developers are grouped in numerous small teams. Because most of our software is based on a microservices architecture, new deployments are made to the production environment every week,” Alejandro continued. “Thanks to Jenkins we are making these deployments much easier but not more often. The frequency is the same but as in the past but now it is much less problematic and simple.”

“With a focus on building cutting edge technology services, we turned to Jenkins because it is easily customizable and scales with our evolving needs,” Alejandro said. “Internal applications and transversal services developed by the architecture team to support common functionalities to the rest of the applications: logging, cache, app configuration, apis, etc. All Of which are supported by their evolving platform.

A use case for acceleration while reducing build times by more than half

Process improvement is top of mind for the ops team at Avoris. And Alejandro shared his story for one critical instance where the use of Jenkins made a big difference. They realized their build times were on the decline, so they sought to minimize their delivery cycle times with Jenkins. The results? The team was able to speed up their CI/CD with shared volumes and more. And they were able to reduce build times more than 50%.

“This specific project was successful due to the vast number of Jenkins plugins available, the extensibility of Jenkinsfiles with the use of Groovy, and many integration possibilities,” Alejandro explained. “Additionally, we relied on a large and helpful Jenkins community and all the Jenkins resources available to us.”

The tech team is also diligent about monitoring performance: “We have a comparison of build times after making major improvements to our Jenkins Pipelines CI/CDs,” Alejandro notes. “By using openshift 4 low compute nodes and shared container storage after migration from Docker to Buildah, a more than remarkable reduction in construction times has been achieved.”

The reductions times included: an improvement from 45 seconds to just 8 seconds for small applications, shaving larger legacy apps by 7–8 minutes, and reducing final image generation time by 10–30 seconds

Simply put, Alejandro said: “Jenkins enables us to do things simply, quickly and in a powerful way.”

The team will continue to enhance their platform with ease because Jenkins offers a” huge number of integration possibilities,” which enables them to make adjustments on the fly. And this team will continue to reinvent their technology — with the help of Jenkins — to support Avoris’ mission to reinvent the travel industry.

Challenge: 
With over 200 developers relying on the company’s infrastructure, they needed a secure, easily customizable, and powerful CI/CD platform.
Solution:
Avoris Travel, a unique travel company seeking to reinvent the travel industry, relies on an equally inventive technology platform fueled by Jenkins.
Results:
▪reduced build times over 50% with the flexibility of Jenkins plugins
▪increased the speed of delivery with Jenkins Pipelines
▪much less problematic and simple deployments for the team
▪scalable infrastructure supporting 675 agencies and over 2.8 million international consumers

Jenkins is an excellent CI/CD tool that has excellent functionalities and the best part is that it is free to use. Based on what we discussed in this what is Jenkins blog, we can conclude that Jenkins has features that boost release agility by providing CI services.

Happy Reading !!😃✌

🔰Keep Learning❗❗ 🔰Keep Sharing❗❗

--

--