What is Jenkins

Jenkins is an open source continuous integration (CI) server. It manages and controls several stages of the software delivery process, including build, documentation, automated testing, packaging, and static code analysis. Jenkins is a highly popular DevOps tool used by thousands of development teams.

Jenkins automation is commonly triggered by code changes in repositories like GitHub, Bitbucket, and GitLab, and integrates with build tools like Maven and Gradle. Jenkins supports the use of container technologies like Docker and Kubernetes for testing and packaging of software releases, but it is neither a Kubernetes native solution or a container-native CI solution.

Jenkins Core Concepts

Jenkins Controller (Formerly Master)

The Jenkins architecture supports distributed builds. One Jenkins node functions as the organizer, called a Jenkins Controller. This node manages other nodes running the Jenkins Agent. It can also execute builds, although it isn’t as scalable as Jenkins agents.

The controller holds the central Jenkins configuration. It manages agents and their connections, loads plugins, and coordinates project flow.

Jenkins Agent (Formerly Slave)

The Jenkins Agent connects to the Jenkins Controller to run build jobs. To run it, you’ll need to install Java on a physical machine, virtual machine, cloud compute instance, Docker image, or Kubernetes cluster.

You can use multiple Jenkins Agents to balance build load, improve performance, and create a secure environment independent of the Controller.

Jenkins Node

A Jenkins node is an umbrella term for Agents and Controllers, regardless of their actual roles. A node is a machine on which you can build projects and pipelines. Jenkins automatically monitors the health of all connected nodes, and if metrics go below a threshold, it takes the node offline.

Jenkins Project (Formerly Job)

A Jenkins project or task is an automated process created by a Jenkins user. The plain Jenkins distribution offers a variety of build tasks that can support continuous integration workflows, and more are available through a large ecosystem of plugins.

Jenkins Plugins

Plugins are community-developed modules you can install on a Jenkins server. This adds features that Jenkins doesn’t have by default. You can install/upgrade all available plugins from the Jenkins dashboard.

Jenkins Pipeline

A Jenkins Pipeline is a user-created pipeline model. The pipeline includes a variety of plugins that help you define step-by-step actions in your software pipeline. This includes:

  • Automated builds.
  • Multi-step testing.
  • Deployment procedures.
  • Security scanning

You can create pipelines directly in the user interface, or create a “Jenkinsfile” which represents a pipeline as code. Jenkinsfiles use a Groovy-compatible text-based format to define pipeline processes, and can be either declarative or scripted.

Jenkins Architecture

Jenkins elements interact and work together in the following way:

  • Developers modify the source code, committing changes to the repository, and Jenkins creates a new build in order to handle the new Git commit.
  • Jenkins can work in “push” or “pull” mode. The Jenkins CI server is either triggered by an event such as a code commit, or it can regularly check the repository for changes.
  • The build server builds the code and generates an artifact. If the build fails, the developer receives an alert.
  • Jenkins deploys the built application/executable to the test server, which can execute continuous, automated tests. Developers receive alerts if their changes impact functionality.
  • Jenkins optionally deploys the changes to the production server if the code has no issues. 

The following diagram illustrates the Jenkins architecture:

Jenkins Architecture

Image Source: Jenkins

You may need more than one Jenkins server to test code in different environments. A single server cannot always handle the load for large projects. If this is the case, you can use the distributed Jenkins architecture to implement continuous integration and testing. The Jenkins server can access the Controller environment, which distributes the workload across different Jenkins Agents. 

This distributed model lets you run different builds and tests simultaneously, with each Jenkins Agent environment running a different version of the code and the Controller controlling the operations. 

Jenkins Advantages and Disadvantages

Here are some of the key advantages of Jenkins:

  • Highly extensible with a huge variety of existing plugins. Plugins contribute to Jenkins’ flexibility and rich scripting and declarative language which supports advanced, custom pipelines. 
  • Robust and reliable at almost any scale.
  • Mature and battle-tested.
  • Supports hybrid and multi-cloud environments.
  • Offers an extensive knowledge base, documentation, and community resources.
  • Based on Java, an enterprise development language with a broad ecosystem, making it suitable for legacy enterprise environments.

Here are some disadvantages of Jenkins:

  • Single server architecture—uses a single server architecture, which limits resources to resources on a single computer, virtual machine, or container. Jenkins doesn’t allow server-to-server federation, which can cause performance issues in large-scale environments. 
  • Jenkins sprawl—this is a common problem which also stems from lack of federation. Multiple teams using Jenkins can create a large number of standalone Jenkins servers that are difficult to manage.
  • Relies on dated Java architectures and technologies—specifically Servlet and Maven. In general, Jenkins uses a monolithic architecture and is not designed for newer Java technologies such as Spring Boot or GraalVM.
  • Not container native—Jenkins was designed in an era before containers and Kubernetes gained popularity, and while it supports container technology, it does not have nuanced support for container and orchestration mechanisms.
  • Difficult to implement in production environments—developing continuous delivery pipelines with Jenkinsfiles requires coding in a declarative or scripting language, and complex pipelines can be difficult to code, debug, and maintain.
  • Offers no functionality for real production deployments—“deploying with Jenkins” means running a fully customized set of scripts to handle the deployment.
  • Jenkins itself requires deployment—this can be difficult to automate. Organizations that need to combine Jenkins with a continuous delivery solution have traditionally used configuration management to do this, but this adds another layer of complexity and is error-prone.
  • Complicated plugin management—Jenkins has nearly 2,000 plugins, which can be overwhelming to sort through until you find a useful plugin. Many plugins also have dependencies that increase the management burden, while some plugins may conflict with each other. There is no guarantee a plugin you use will continue to be maintained.
  • Groovy expertise requirements—Jenkins has programmatic pipelines implemented in Groovy, a language that is currently not in wide use and can make scripts difficult to work with. Jenkins supports scripted and declarative Groovy modes. 

For these reasons, many teams are transitioning away from Jenkins and adopting newer solutions that are more supportive of a containerized, microservices-oriented DevOps environment.

What Is Jenkins X?

Jenkins X is a CI/CD solution that continuously ships applications with Kubernetes. Jenkins X emphasizes CI/CD automation for the cloud.

Jenkins X combines Jenkins with open source tools like Helm, Docker, Nexus, and KSync. It automatically installs, configures, and upgrades these tools to integrate them into your CI/CD process.

Jenkins X offers feedback for all pull requests, providing previews before pushing code changes to the staging and production environments. It helps you incorporate authentication and reliability early on, preventing post-deployment surprises. You leverage a higher degree of automation to enable frequent, secure, and predictable software releases. 

Jenkins X is useful regardless of your familiarity with Kubernetes, providing a CI/CD process to facilitate cloud migration. It supports bootstrapping onto your chosen cloud, which is crucial for a hybrid setup.

However, Jenkins X also has the following drawbacks:

  • A primary drawback of Jenkins X is that the project went through rapid change, which makes it difficult to adopt by new users and challenging to maintain for existing users.
  • It only deploys via Helm, so you need to adopt Helm if you haven’t.
  • It requires trunk-based development.
  • It lacks its own UI (it relies on the limited Jenkins UI), so you need to use the command line for new constructs. 
  • Scales by adding builders to its Kubernetes cluster and automatically connecting Jenkins Slaves to the Master. 
  • You can implement a serverless installation without a Master, which consumes excessive resources.

Codefresh: A Modern Alternative to Jenkins

You can’t get to continuous delivery or deployment without first solving continuous integration. Codefresh automatically creates a Delivery Pipeline, which is a workflow along with the events that trigger it. We’ve added a pipeline creation wizard that will create all the component configurations so you can spend less time with YAML and more time getting work done. 

At the end of the pipeline creation wizard, Codefresh commits the configuration to git and allows its built-in Argo CD instance to deploy them to Kubernetes.

The Delivery pipeline model also allows the creation of a single reusable pipeline that lets DevOps teams build once and use everywhere. Each step in a workflow operates in its own container and pod. This allows pipelines to take advantage of the distributed architecture of Kubernetes to easily scale both on the number of running workflows and within each workflow itself.

Codefresh Delivery Pipelines

Teams that adopt Codefresh deploy more often, with greater confidence, and are able to resolve issues in production much more quickly. This is because we unlock the full potential of Argo to create a single cohesive software supply chain. For users of traditional CI/CD tooling, the fresh approach to software delivery is dramatically easier to adopt, more scalable, and much easier to manage with the unique hybrid model.

Conquer DevOps with Codefresh

Conquer DevOps with Codefresh

Realize your true DevOps potential with the premier GitOps solution powered by Argo.

Check It Out