Jenkins for CI Is Dead: Why Do People Hate It and What’s the Alternative?
By: Dimitris Poulopoulos
Tags: Github Actions, Programming, Jenkins, Technology, DevOps

Automatically Build your Docker Images

I believe that many of you reading this article love Jenkins. I am sure that many of you are furious right now. Maybe you have spent months learning Jenkins, and have really dived deep into its internals. If you are in a similar position, I can understand why you are not ready to give it up just yet.

To try and convince you, I will use a simple example. I will go through the most popular CI use case today: how to automate the process of building and pushing your Docker images.

However, this is not a tutorial on how to build and push Docker images with Jenkins. Instead, I will only provide a high-level view. So, given that you already have a repository with your code pushed to Github, here are the steps you need to cross to achieve your end goal:

Install Jenkins: Jenkins is typically run as a standalone application in its own process with the built-in Java servlet container/application server (Jetty). However, you can also use the official Docker image to run Jenkins inside a container. Integrate with GitHub: You can access Jenkins via your browser (typically on localhost:8080 ) and create a new project. You should specify the GitHub repository URL address, when a build should be triggered, and the target command. Install a Docker plugin: To build and push images to a repository (e.g., Dockerhub), you need to install a new plugin. For example, you can install the Docker plugin, the Docker Build Step, and the CloudBees Docker Build and Push plugin. Configure the Docker plugin: You should specify a new build step in the Jenkins UI that leverages the newly installed plugins. In addition, you should specify the registry you want to push your image to, the image name and tag, and your credentials.

Why is this Bad?

Now that we’ve seen the procedure, you might say that this is not too bad. Just four steps. However, some of these steps are not easy to cross:

Jenkins instances are usually too complex. That means an organization needs a Jenkins expert to install, maintain and secure the instance.

Experts become bottlenecks. You, as a developer, depend on a Jenkins expert or admin to create a new project, build, release, etc. This quickly becomes a prolonged process.

Self-service seekers will create new, insecure Jenkins instances to address the expert bottleneck issue. In addition, they will install new plugins without testing and introduce vulnerabilities.

Usually, you need to install a ton of plugins before start working with Jenkins. Unfortunately, this makes the instance too complex, difficult to navigate, and the Jenkins controller slows way down.

You would expect not to do so much manual work on an automation tool. Jenkins is tough to scale efficiently. Not all plugins are supported by Jenkinsfile , so a Jenkins instance is hard to back up without manual effort. Moreover, the database is just XML files on the disk, making it a nightmare to scale up or out or perform high availability upgrades.

, so a Jenkins instance is hard to back up without manual effort. Moreover, the database is just XML files on the disk, making it a nightmare to scale up or out or perform high availability upgrades. Jenkins needs a dedicated server (or several servers) to run on. That results in additional expenses. More often than not, an organization needs to have a DevOps team dedicated to Jenkins.

What’s the Alternative?

For CI, and maybe not only CI, I prefer to use GitHub actions. So, how can you build and push Docker images with GitHub actions? Let’s see the steps:

Setup: Create a new folder inside your project’s root folder. Name it .github/workflows . Configure: Add a new YAML configuration file inside the workflows folder you created. This file looks something like this. A numbered list of steps that every step does one simple thing. Authenticate: Add your registry’s (e.g., Dockerhub) credentials to your project as an encrypted secret. Run: All you need to start the process is to push new commits of your code to GitHub.

The most important thing? There is nothing to install, configure, maintain, upgrade, or patch. Everything runs on GitHub servers that you don’t have to care about. Moreover, with the GitHub marketplace (think of it as an alternative to Jenkins plugins), you can do almost anything.

Conclusion

Jenkins is the leading open-source automation server, with hundreds of plugins to support building, deploying, and automating any project.

However, the Jenkins way is not an easy and straightforward way to build a CI pipeline. Installation, maintenance, plugins, security, amongst other things, make the process slow, create bottlenecks, and introduce vulnerabilities.

This story showcases the steps you need to cross to automate building and pushing Docker images using Jenkins and GitHub Actions. In my opinion, using a tool like GitHub Actions blows out of the water the Jenkins way. What’s your opinion?

About the Author

My name is Dimitris Poulopoulos, and I’m a machine learning engineer working for Arrikto. I have designed and implemented AI and software solutions for major clients such as the European Commission, Eurostat, IMF, the European Central Bank, OECD, and IKEA.

If you are interested in reading more posts about Machine Learning, Deep Learning, Data Science, and DataOps, follow me on Medium, LinkedIn, or @james2pl on Twitter.

Opinions expressed are solely my own and do not express the views or opinions of my employer.