Jenkins Pipeline Builds and A/B Deployments in CDK

Jenkins is great, and it has done a lot to make our lives easier. It seems like not so long ago when the idea of continuous integration tools was a daunting task. Jenkins came to the rescue, and I (and many others) use it a lot... A LOT.

Given that my day to day work is in consulting, I'm constantly working in different development environments with different technologies - and a common thread among all those environments is Jenkins. It is pervasive, there are tons of plugins, and it is fairly easy to extend. But there are issues we used to take for granted that start to seem more problematic in today's modern ecosystem of build tools.

The problems start arising when you're trying to build pipelines with Jenkins. Pipelines that need to build, push, and pull many different things from many different places. Each of those things generally requires some kind of plug-in, and from my experience it never quite meets 100% of my use case; something always seems to be missing

Wouldn't it be nice to simply have a more CLI driven, programmatic approach and not have to forego power and customization for ease of use? Do we really need a GUI to help us build our builds and processes? I argue that the answer is "no".

Here's the thing: As a developer or team lead, it is not uncommon to have to build all these processes by hand first to see how they work for your project, at which point you'll then have to re-implement it on Jenkins. So why not just reuse that initial prototype? Okay you get the point; you feel or have felt my pains, but what's next? There is a new wave of CI tools that put the power back into the developers hands.

Tools like Travis-CI are changing the way we build CI pipelines. Since Travis integrates with GitHub, you simply add a .yaml file to your project and Travis picks this up, kicks off your first build, and you're on your way to fully automated CI.

I also really like, and am a proponent for GitLab-CI. It is a similar concept to Travis-CI, except instead of being a Github add-on, it is all in one SCM solution and CI tool. You can set up a docker registry, and can use any of those docker containers in your CI build... Sweet! Now we can dynamically spin up an environment, test our stuff, and tear it down - no longer do we need a dedicated server for our builds. The OPS team can control which containers are available so that the environment is representative of production or staging environments, or you can "go rogue" and build the custom environment to meet your needs.

Another cool feature of Travis CI and GitLab is the fact that the your projects CI/CD configuration is all under source control along-side the project source code, which would take an extra step be if you were using the Jenkins GUI tooling. It is true that you can write your Jenkins jobs via a DSL (and subsequently check that into version control), but doing so is extra manual work, and the scripts are written in Groovy, which I consider to be a negative.

Funny story: Before I could finish writing this article, the Jenkins project announced Jenkins 2.0. So, it seems the Jenkins team is feeling the wind of change as well.

I haven't had a chance to use it, but from reading the documentation it might be a good balance between ease of use (GUI), and a more common DSL. So if you're a heavy Jenkins shop, be patient. Change is coming and looks to be for the better. Happy coding!

Editor's note: Red Hat is also focusing heavily on DevOps. More information can be found on the Red Hat Developers DevOps topic page.

Last updated: September 7, 2023