What Is Jenkins X?

Jenkins X is a cloud native, Kubernetes-only application that supports CI/CD but simplifies work with Kubernetes. James Strachan initially introduced it in March 2018. 

Jenkins X enables you to use one command to create a Kubernetes cluster and install all tools required to manage the application. It also lets you set up build and deployment pipelines to deploy applications to several environments.

Jenkins is an extensible automation server that you can configure using plugins to work as: 

  • A continuous integration (CI) server
  • A continuous deployment hub
  • A tool that automates software tasks

 

Jenkins X provides a specific Jenkins configuration that already includes plugins for a CI/CD pipeline. It can deploy many applications to Kubernetes to enable development teams to build a container, store it in a Docker registry, and deploy it to Kubernetes.

How Jenkins X Works

Jenkins X does not require you to interact with Jenkins directly. You can use Jenkins X without installing Jenkins. Jenkins works behind the scenes to run CI/CD pipelines for repositories and uses Kubernetes to orchestrate actions.

Jenkins X defines several features in the software development lifecycle (SDLC) and makes pipeline decisions for users. It offers automatic feedback on various issues, pull notifications, and commits. It also lets users modify the SDLC to suit unique needs.

Here is how it usually works:

  • When you start a new project, Jenkins X will create all the necessary files and structure. 
  • If you require Kubernetes clusters, Jenkins X installs and configures all required tools. 

 

Once you start using Jenkins X, it lets you use a single command to create a Git repository, set up a webhook, or create a CD pipeline.

Jenkins X includes quick-start tools that enable you to start working in minutes. It provides a language package that can write the sample application in the language of your choice. It containerizes the app and commits the Helm charts, Dockerfile, Jenkinsfile, and Skaffold workflow to an integrated Git repository.

Here are notable automation features:

  • Teams using Jenkins X receive a suite of environments, which Jenkins X manages automatically. 
  • Jenkins X automatically manages the progress of each new application build between GitOps and the environments, 
  • It automatically generates preview environments for your pull notifications to provide fast feedback before merging changes with a master application.

 

Related content: Read our guide to Jenkins Pipeline

What Are the Main Features of Jenkins X?

Here are notable features of Jenkins X:

Automated CI and CD 

Jenkins X provides a command-line tool that enables installing it inside a new or existing Kubernetes cluster. You can use the tool to import projects, bootstrap new applications, and automatically create pipelines for a project.

Environment promotion via GitOps 

You can use Jenkins X to create different virtual environments for staging, production, and development, using Kubernetes Namespaces. Each environment gets specific configurations, a list of versioned apps, and configurations stored in a Git repository. 

Jenkins X automatically promotes new versions of an application between environments while using GitOps practices. It can also let you manually promote your code from one environment to another and configure or change new environments as necessary.

Preview environments 

You can create a preview environment manually, but that is not necessary. Jenkins X automatically creates a preview environment for every pull request. It enables you to see the impact of changes before you merge them. Jenkins X also adds comments to the pull requests that include a link to these previews for team members.

Creating Your First Project in Jenkins X

Jenkins X Installation 

3.x of jx is available for download from https://github.com/jenkins-x/jx/releases.

Since many components of Jenkins X are available as custom resources, you can also interact with Jenkins X using kubectl.

You can copy a jx binary to a directory in your $PATH. After installing the jx binary in the $PATH, you’ll be able to run the following:

jx version

If your jx binary is recent, you should run the following:

jx dash

This command opens the dashboard with a basic authentication password to log in.

Jenkins X

Image Source: Jenkins X

Creating a Project 

You can create new projects from quickstart templates using the following command:

jx project quickstart

Creating a quickstart or importing a new project will create a new release and trigger promotion in the same way as in Jenkins X v2.

One important difference between Jenkins X and Jenkins X v2 is that you include specified Kubernetes resources in Git by default. You don’t simply refer to the Helm chart’s name and version. 

The standard workflow is as follows:

  1. Within the pipeline, the promotion step creates a Pull request on your cluster repository, allowing the cluster to upgrade or add the Helm chart and version.
  2. The generate and apply functions run, filling in further details of the Kubernetes resources to be added, changed, or deleted to the Pull request.
  3. The pipeline adds another Git commit labeled “regenerated” to the pull request. 
  4. It adds a “updatebot” label to the pull request to enable automatic merging when all the Git checks pass (are green), including the pull request pipelines.
  5. After a pull request merges with the main branch, the Git operator triggers the apply function to apply the relevant Kubernetes resources to your cluster. 

The newer GitOps model makes this workflow slightly more complex than the v2 equivalent. You handle imports via GitOps, and the Git changes result in Job/Pipelines running in your cluster to implement the changes.

To create a project using an import or create quickstart, use the following steps:

  1. Run the import or quickstart command.
  2. It will create a new Git repository if you create a quickstart using the quickstart command or run the import command in a new directory (that you haven’t pushed to a Git repo before).
  3. It creates a pull request on the cluster repository and registers the application’s repository to your cluster.
  4. Next, the jx project command will wait for the pull request to merge, an update to the Lighthouse configuration to include your new repository, or for you to set up a webhook for your new repository.
  5. The pull request on the cluster repository will trigger a pipeline to implement a promotion workflow.
  6. After merging the pull request, the apply function will run, updating the Lighthouse configuration and registering a webhook for Lighthouse on your app repository.
  7. The jx project command continues to push the new pipelines for your application to your Git repository’s main branch. 
  8. It will trigger a new pipeline that runs on the app to create a new application release.
  9. After completing the new release, the pipeline will create a pull request to trigger the promotion workflow for the new version of your application. 
  10. When the promotion pull request merges, the application will run in the staging environment.

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