Industry Use Case of Jenkins

Industry Use Case of Jenkins

Development Before Jenkins

Before the advent of Jenkins, developers had to complete code testing before they could check for errors. Developers on teams, tending to work independently, each created large segments of code to add to the base code. The entire source code would be checked for errors — a time-consuming and challenging undertaking. Multiple developers would each send commits to version control, increasing the time required to identify and fix bugs. There was no iterative code improvement, and the software delivery process was slow. So for them Jenkins came to the rescue!

What is Jenkins?

Jenkins is an open-source continuous integration tool or automation server written in Java.


It gives us a faster and more robust way to integrate our entire chain of build, test, and deployment tools that we can easily build ourselves.

Today Jenkins is the leading open-source automation server with some 1,600 plugins to support the automation of all kinds of development tasks related to buildingtesting, and delivering or deploying software. so that humans can spend their time doing things machines cannot.

Jenkins is commonly used for:

  1. Building projects
  2. Running tests to detect bugs
  3. Static code analysis
  4. Deployment

Execute repetitive tasks, save time, and optimize our development process with Jenkins.

No alt text provided for this image

Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed.

How does continuous integration work ?

Continuous integration (CI) is an integral part of the software development process. It can consist of a number of different tasks, including the use of unique functionality in the repository, feature development, and bug fixes amongst others.

No alt text provided for this image

A continuous integration tool, such as Jenkins, is great in identifying issues with current application sources and provides speedy response by checking the integration process with the help of automated build and test features.

The waterfall models and other such development approaches can also benefit from what continuous integration has to offer. CI often works in tandem with continuous delivery (CD) to deliver executable code to production at a much faster pace and in an automated way.

Listed below are common CI practices :

  1. Regular code committing
  2. Build staging
  3. A build machine dedicated to the integration
  4. Continuous feedback
  5. Developer test categorization

Continuous integration can be released at whatever frequency you deem appropriate considering your project and company. So, companies that use CI have more regular releases than those that use traditional software development processes.

Lead time:

Early feedback and build/test automation help decrease the time it takes to go from code committed to code successfully running in production.

Deployment frequency:

Automated build and test is a pre-requisite to automated deploy.

Time to restore service:

Automated pipelines enable fixes to be deployed to production faster reducing Mean Time to Resolution (MTTR)

Change failure rate:

Early automated testing greatly reduced the number of defects that make their way out to production.

This helps DevOps teams to get rid of the errors in every stage of development. It also detects problems quite early in the development process. This makes these problems less disruptive, not too complex, and easy to handle.

How does continuous delivery work ?

Continuous delivery is a part of the software development process that enables you to go ahead with development in such a manner that we are always ready to release the software to production.

No alt text provided for this image

Here are a few times when continuous delivery proves additionally fruitful:

1. The DevOps team ensures that the software is deployment-ready even when feature development is under progress.

2. The software is ready for deployment throughout the software development cycle.

3. Deployment through push-button means is a reality for different versions of software to different on-demand environments.

How can continuous delivery be achieved ?

The first requirement is that the software should be already undergoing continuous integration. The development team should then build the executables and perform tests on them to detect errors or bugs.

No alt text provided for this image

Also, it is very important to test the executables in different production environments to ensure that the software is ready to be sent to production at any time. For this, having a deployment is necessary.

Automation of Jenkins allows companies to speed up their software development process quite significantly. Jenkins is capable of integrating different types of software development lifecycle processes, including building, testing, deployment, and others.

Plugins are very important for ensuring continuous integration. If you are looking to add a new tool to Jenkins, you will first have to make sure that you install a plugin for it.

What is Jenkins pipeline ?

A Jenkins pipeline is a combination of jobs, tasks, or events that are connected to each other in a sequence. In other words, it is a group of plugins that enable continuous delivery pipelines to be easily integrated and implemented

No alt text provided for this image

Extendable automation works to support a pipeline in the creation of both complex and simple delivery pipelines in the form of code and with the help of domain-specific language or DSL.

The basic characteristic of a Jenkins pipeline is that each event or task or job that it holds is dependent in one way or the other on one or more of these events, jobs, or tasks. Continuous delivery pipelines feature different states, such as build, test, deploy, release. All these states are connected to each other.

JenkinsFile:

JenkinsFile is a text file that is used to define Jenkins pipelines. JenkisFile is often used to implement pipelines in the form of code, and this entire process is defined using DSL.

We can also use the JenkinsFile to write down the steps that need to be followed to run Jenkins pipelines.

Mentioned below are some benefits of using JenkinsFile :

  1. It makes reviewing the code on the pipeline easy.
  2. It can help you execute pull requests for all the pipelines that you have created for different branches.
  3. It is the one and the only source for your pipelines that can be modified by different users.
  4. It can help you conduct an audit on your Jenkins pipeline.

JenkinsFile is defined using two types of syntax :

1. Declarative pipelines syntax :

Creating pipelines is much easier with this syntax. It features a well-established hierarchy that helps in creating pipelines.

It offers we have a simple ways to exercise control over every aspect associated with the execution of pipelines.

2. Scripted pipeline syntax :

It uses a lightweight executor and runs on Jenkins master. It has its own set of resources that it puts to use to convert pipelines into atomic commands.

As is quite evident from their definitions, both these syntax are quite different from each other. Not only this, but they are also even defined in different ways.

Why should you use Jenkins pipeline ?

Jenkins automates that software development process through its continuous integration capabilities. You can use different use cases to create a number of automation jobs and then use Jenkins pipeline to run all of them.

Listed below are a few reasons for using Jenkins pipeline :

  1. As it is implemented in the form of a code, Jenkins pipeline can have a number of users who can edit and execute the process.
  2. It supports projects that are larger in size than usual. Running multiple projects at a time or using pipelines in a loop are all possible.
  3. They are robust. You don’t have to worry if your server restarts under unforeseen circumstances. Jenkins pipeline would resume automatically.
  4. The pipeline process can be paused and not resumed until you receive user input.

Jenkins Architecture:

The Jenkins CI server checks the repository at regular intervals and pulls any newly available code.

No alt text provided for this image

The Build Server builds the code into an executable file. In case the build fails, feedback is sent to the developers. Jenkins deploys the build application to the test server.

Jenkins Distributed Architecture:

Jenkins manages the builds with the help of master-slave architecture. Master and slave units communicate with each other using IP/TCP protocol. Here is a little download on how it all works.

No alt text provided for this image

Jenkins master :

This is the primary server of Jenkins. It handles a number of tasks that include but are not limited to scheduling build jobs, recording and presenting build results, dispatching builds to slaves for execution, monitoring all the slaves offline as well as online, and others. Master Jenkins is capable of directly executing build jobs.


Jenkins slave :

It runs on the remote server. The Jenkins server follows the requests of the Jenkins master and is compatible with all operating systems. Building jobs dispatched by the master are executed by the slave. The project can be suitably configured to choose a specific slave machine.


These are the few benefits of Jenkins :

No alt text provided for this image
  1. Jenkins is an open-source tool that is extremely easy to install and use. You need no extra components to use it.
  2. It is free and available to be used with different platforms, such as Windows, Linux, macOS, and others.
  3. It is widely used, so finding support on online communities is not a big problem.
  4. Jenkins automates all integration work. Integration issues are scarce, and so, it helps in saving time and money over the project lifecycle.
  5. It is easy to configure, extend, and modify. It allows the instant generation of tests and building, automation, and deployment of code on different platforms.
  6. Jenkins can be configured to run CI and CD concepts properly.
  7. It can easily detect and fix issues. The software is always ready for a sudden release
  8. Supports a variety of plugins, which allows better flexibility.
  9. It helps in detecting errors very early, thus saving developers a lot of time and hard work.

What are the plugins ?

Jenkins has a powerful extension and plugin system that allows developers to write plugins affecting nearly every aspect of Jenkins’ behavior. Even a large part of “core” functionality is written in terms of extensions — extensions that could as well be contributed by plugins.

No alt text provided for this image


Some of the more obvious extension points include SCM implementations, integrating SCMs like Git, Subversion, or Perforce into Jenkins; build steps, providing everything from a convenient UI to configure build tools, to sending emails; or authentication realms, integrating Jenkins with Single Sign-On systems, or external user directories such as LDAP or Active Directory.

Increase productivity with Jenkins plugins :

Here are a few of the most common plugins used by developers.

Job generation plugin :

Maintaining project jobs in growing or bigger organization is a little difficult, more so because developers are often working on different branches and releases.

While we are ready to let developers create jobs on their own, we are not sure whether they will be able to meet company standards. This is a big dilemma.

This plugin lets you define templates, which your developers can use to create jobs. We can disable configuration access of the template using the role-based authorization plugin.

Global build stats plugin :

Knowing our current capacity, capabilities, and usage is very important to prepare ourself for system requirements or capacity planning.

We should be aware of the number of builds that are happening on a regular basis. We also need to know the time required to release builds.

This plugin provides you with all the necessary information required to answer all these questions.

GitLab/GitHub pull request builder :

We can use this template to automate the code review process in GitLab/GitHub to a level that is higher than usual.

No alt text provided for this image

For every pull request, We can expect this plugin to not only run the build but also build results and share the status with a pull request or collect important static analysis.

This plugin tells a lot about the code that needs to be merged. It is also possible to define automatic merge in some circumstances using this plugin.

Industries Using Jenkins

No alt text provided for this image

Topdanmark

Topdanmark is a leading Danish insurer who chose Jenkins as the “de facto” product to build their CI/CD platform.

No alt text provided for this image


Challenge:

Balancing the needs of DevOps modernization and cloud migration while maintaining legacy systems.


Solution:

A highly-configurable CI/CD platform which allows for automation and ease of development.

Results:

  • 100% automatic creation of Jenkins instances
  • the ability to release and deploy an artifact whenever, wherever
  • software developers focused on developing software rather than operations
  • smaller monoliths and containerization

Topdanmark has two Jenkins setups. They have two sets of systems, legacy and CI/CD. In their legacy setup, they have test, integration, release, and production environments. In their CI/CD setup, they have a non-production and a production environment.

“We used Jenkins because almost everyone knows what Jenkins is and how to use it. It is the ‘de facto’ product to use in our world. And it’s extremely configurable.” said DevTools engineer Jon Brohauge.

HP

No alt text provided for this image

In 2006, HP’s LaserJet Firmware division built different products(printers, scanners, etc.). This entire project was led by the director of LaserJet Firmware, Gary.

He analyzed developers spent around 5% of their time developing and supporting new features while the rest went into planning, integration, and testing.

Problem

  1. Gary’s team consisted of around 400+ developers distributed across countries like the USA, Brazil, and India but only made two software releases per year! This is because LaserJet models had separate code bases which developed enumerable inefficiencies.
  2. Software bugs were detected via manual testing after 6 weeks of writing code. Fixing a bug that incurred within a code weeks ago, was labor-intensive and tiresome for the developers.
  3. This is where the team needed a new approach to remove the bottleneck

Solution

The HP team adopted a Continuous Integration/Continuous Deployment (CI/CD) pipeline and test automation.

As we can see in the given figure below, their first step was to create a common platform to support all the products and models. This was called trunk-based development or Continuous Integration which eliminated toil caused by the integration of different code branches.

No alt text provided for this image

Conclusion :

This blog provides a sound idea of how Jenkins works and how it can be used for implementing different project ideas using CI/CD and also its use-cases.

It is one of the most preferred DevOps tools these days that makes things very easy with its effective interface and plugins.

To view or add a comment, sign in

Insights from the community

Explore topics