Jenkins and its use cases

Jenkins and its use cases

·

13 min read

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.

jenkins_blogbanner.gif

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 the identification of issues in the product at an early stage of development.

History of Jenkins.

It goes back to 2004, Kohsuke Kawaguchi, the developer of Jenkins, was working with Sun Microsystems as a Java developer.

pic_award_kawaguchi.jpg

Little did Kawaguchi know that the future had something very special in store for him. At that time, Kawaguchi was involved in several development projects. He didn’t like breaking the builds due to code failure. This made him look for something that could help him know whether the code will work or not before it is committed to the repository.

This curiosity led the way to the development of an automation server named Hudson. In 2011, there was an infamous dispute between the independent Hudson open source community and Oracle, which now has Sun Microsystems under its umbrella.

This dispute led to a fork, which was named Jenkins. Both Jenkins and Hudson continued to exist for a long time; however, Jenkins was the more preferred choice. The Hudson project was shut down in January 2020. Jenkins is still active.

What is Continuous Integration?

In an Agile world, agile developers began to embrace and promote test-driven development and continuous integration (CI). With these techniques we could automatically build source code whenever a developer checked it into a source repository, executing an exhaustive unit test suite to ensure that an application was working properly. Many test-driven developers also started doing integration testing and performance testing in a secondary CI process.

With continuous integration, we could detect errors more quickly and release code much faster than we had done in previous years. It's no exaggeration to say that CI tamed the "build" side of the build-and-deploy cycle. These days many dev teams have moved beyond CI to CD, which stands for either continuous delivery or continuous deployment. Whatever the designation, the CD is a process that moves software from code check-in to staging, or even production deployments.

Jenkins-architecture-1.png

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

Let us now discuss a little about continuous delivery pipelines and how they work. 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.

jenkins pipeline.png

A continuous delivery pipeline is a sequence that events of each of these states work in. It is an automated expression that processes required for getting version control software. All the changes that are made to the software have to pass through several complex processes before the software is released. This process also ensures that the software is developed in a repeatable and reliable way and involves multiple testing and deployment stages, which the software progresses through.

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)

An 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:

0 5AS84RqifsWDX9vN.jpg

Jenkins Master-Agent 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).

0 cx5gP-YjOQ4wUOm1.jpg

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

Advantages of using Jenkins

  • Jenkins is being managed by the community which is very open. Every month, they hold public meetings and take inputs from the public for the development of the Jenkins project.
  • So far around 280 tickets are closed, and the project publishes a stable release every three months.
  • As technology grows, so does Jenkins. So far Jenkins has around 320 plugins published in its plugins database. With plugins, Jenkins becomes even more powerful and feature-rich.
  • Jenkins also supports cloud-based architecture so that you can deploy Jenkins in cloud-based platforms.
  • The reason why Jenkins became popular is that it was created by a developer for developers.

Jenkins Industry Use Cases:-

Jenkins Case Study: Topdanmark:-

topdanmark-logo.jpg SUMMARY : Topdanmark, a leading Danish insurer chooses Jenkins as the “de facto” product to build their CI/CD platform.

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.

Jenkins Case Study: Gainsight:-

gainsight-768x221.jpg

SUMMARY : Gainsight’s CSX platform helps the customer success teams at over 100 leading IT and healthcare organizations drive engagement for tens of thousands of their customers. That’s why the engineering team at Gainsight built a smarter, faster DevSecOps platform using Jenkins.

CHALLENGE : Maintain an infrastructure-as-code approach while integrating various tools and programming languages within the platform, all while securing processes with better visibility and air-tight quality control.

SOLUTION : A flexible and scalable DevSecOps infrastructure that provides Gainsight with keener operational insight, ease of collaboration, and the ability to accelerate releases to stay a step ahead of the competition.

RESULTS :

  • Infrastructure costs reduced by 40%
  • Builds are 30% faster
  • Better and seamless communication on builds and releases
  • 95% of infrastructure scalable with code
  • Virtually no more manual processes

Thank you for Reading