X

Jenkins helps DevOps plug in to automation

Everyone wants automation, and a name we hear quite frequently with regards to automation is Jenkins. We hear about Jenkins jobs and Jenkins directories and Jenkins plugins, but what exactly is Jenkins? Well, it is an open source continuous integration and continuous delivery (CI & CD) server with which organizations can automate their software development process. Jenkins does this by managing and controlling development lifecycle processes by breaking them up into Jenkins jobs.

Jenkins jobs are any particular tasks or steps in your build process that you’re having Jenkins do for you. This may involve simply compiling your source code and running your tests, or something more complicated like measuring code coverage or code quality metrics or even deploying your application to a web server.

With regards to Jenkins directories, the Jenkins home directory contains all the details of your Jenkins server configuration which are stored in a set of XML files. A good example would be the core configuration that’s stored in the config.xml file or the details of your Maven installations, which are stored in a file called hudson.tasks.Maven.xml.

Fully automated CI/CD

Before we had CI/CD, following the “old-school” or waterfall approach meant shipping few overloaded releases as opposed to frequent light ones. We all know what a nightmare this old-school process can be and hence we have DevOps and CI/CD. Continuous Delivery is all about getting used to the most stressful part of software delivery — deployments. CD makes deployments smaller, more frequent, and a natural extension of development and testing done right.

This is why automating the entire release process is so important as it greatly increases release frequency. Jenkins is easily the most used tool for automating right from build to deployment and it’s been around for a while. It also has one of the largest open source communities and an enterprise version for those who need it.

Meet the plugins

Apart from the fact that setup can also be automated, Jenkins greatly helps increase team productivity by building shortcuts. A good example would be in the development phase where you get to validate your modified code bases more frequently with single-click build and deploy jobs. It’s the plugins, however, that really increases Jenkins’ capabilities straight from dev to deployment, and there are literally thousands of them that add a lot of cool features to the tool.

Jenkins defines extensibility points that model an aspect of a build system that needs to be implemented. Jenkins then allows plugins to contribute to those implementations via the extensibility points. A lot of powerful features that help you increase productivity and security come from these plugins.

The Job Generator plugin, for example, is used in rather large organizations where it’s difficult to keep track of who’s working on what. While you want to make sure you give access to those who require it, you also don’t want to give everyone free rein to do whatever they want. This plugin lets you define templates to make sure all jobs meet a certain standard. Developers can also create new jobs with the help of job generator template. Configuration access can also be disabled via role-based authorization plugin.

A few more examples of plugins are the Embeddable build status plugin or the Exclusion plugin. The former plugin gives you a link to expose the status of the build and the latter enables you to handle conflicts between jobs. Disable-failed-job is used to define the maximum number of consecutive failed builds before a system is automatically disabled.

Jenkins in the cloud

One of the little-mentioned features of Jenkins is its ability to scale out to a large number of nodes and distribute the workloads evenly between them. If your own infrastructure is not large enough, then the AWS plugin or Microsoft’s new ACS and ACI plugins lets you tap into the resources of the public cloud. You can then specify the AMIs you’d like to use, provide connection credentials and test connectivity.

Microsoft only recently announced Jenkins plugins for both its ACI and ACS platforms and described Jenkins as being able to “initiate and monitor the execution of a task, check the outcome, and initiate the next stage.”

While Jenkins integrates well with virtual machines like the new VMware AirWatch integration, ACI does not need any virtual machine infrastructure to manage it and additionally allows containers to be deployed and billed by the second. The Jenkins plugin for ACI began previewing in July and instead of a VM, you can create a container agent that takes a fraction of the time to provision since it’s based on a Docker image.

Jenkins and Kubernetes

Pui Chee Chan, senior program manager at Microsoft, said the company developed the plugin after it failed to find an option allowing for native continuous deployment from Jenkins to Kubernetes. This plugin allows users to leverage any of their Docker images as templates for on-demand instances that Jenkins tells Kubernetes to launch whenever required.

The CloudBees team and the Jenkins community have also created a Kubernetes plugin for Google Cloud Platform that allows Jenkins slaves to be built as Docker images and run in Docker hosts managed by Kubernetes. While this plugin does allow Jenkins agents to be dynamically provisioned on any Kubernetes cluster, it only works on GCP or on-premises as of now.

How it works is once a Kubernetes pod running the slave container is deployed, the Jenkins jobs requesting that specific slave are built directly inside the Pod’s slave containers. Kubernetes then takes the slave Pods offline after the build completes.

Because it’s important to remain scalable and predict for future growth, this is probably why organizations prefer environments like Docker images that can be easily replaced and templated. This also makes for higher resilience in case some environments go offline when the demand for a Jenkins master increases. In such cases, new ones can be created quickly and automatically. The fact that it also works with Kubernetes is just icing on the cake.

The DevOps engine

Developers are always looking for “downstream systems” that they can plug into their existing development environment or software project management software. This has led to an increased use of tools like Jenkins, Chef, or Puppet, especially since they’re open source. Another popular open source tool that you can plugin to Jenkins is called Blue Ocean, an open source pluggable user interface or a “skin.”

It’s a lot easier to work on Blue Ocean than Jenkins and it makes the job of automating your CI/CD pipelines even easier. Blue Ocean 1.0 comes bundled with visual pipeline editor for software delivery that provides a WYSIWYG capability to create and commit code pipelines into Git or GitHub. Other features include pinpoint troubleshooting and personalization like for customized dashboards.

Jenkins has definitely come a long way from the Hudson Project that began at Sun Microsystems and has become so popular that some people are even calling it the DevOps engine. With over a half-million active nodes and counting, Jenkins shows no signs of slowing down, thanks to its vast collection of plugins.

Photo credit: Shutterstock / Jenkins