Hidden Tricks of Jenkins to Bolster Continuous Integration on Pivotal Cloud Foundry
Why use Jenkins on Pivotal CF?
Jenkins is one of the many solutions developers use for continuous integration and continuous delivery (CI/CD). At the SpringOne Platform convention 2017, Andrei Krasnitski of Altoros gave attendees insights into which of the plugins for Jenkins are underrated by developers.
Firstly, Andrei listed a few reasons why using Jenkins at all. In addition to the ease of use / installation / setup, Jenkins provides support for all environments, has extensive documentation and tutorials, requires low input threshold, and is highly customizable.
With Jenkins, users can implement their own features within their own Jenkins files, which are then made available to other Jenkins users. This simplifies troubleshooting as developers can just share solutions to problems.
“If you need help with a difficult step and know that someone from your team has already solved the problem, you just need to import the function, and you can use it in your own pipeline file,” explained Andrei.
“When you start your CI/CD journey, you need to understand that the process is more complicated than just build, test, and deploy.” —Andrei Krasnitski
By storing pipeline code in a shared repository like GitHub, disaster recovery is as simple as going back to a previous build. This also enables developers to easily track changes made to the code, as well as who made them.
Though Concourse is a great CI/CD tool built specifically for Cloud Foundry, Jenkins is still a solution of choice for many developers who are used to working with it. The good news is that it can be enabled by simply using this PCF tile. All you need is “download the tile from the Pivotal Network, import it to the PCF Ops Manager, and then click to apply changes,” noted Andrei.
An ecosystem of Jenkins plugins
At large, the ease of customization provided by Jenkins comes through its eloquent ecosystem of 1,000+ plugins. A substantial part of the tool’s core functionality “is written in terms of extensions” and can be enhanced by plugins.
The Jenkins documentation exemplifies the following extension points:
- Implementation of software configuration management systems like Git or Subversion
- Build steps, furnishing a users with anything necessary from a UI for configuring tools to a preferable means of sending e-mails
- Authentication modules—ensuring integration with single sign-on systems or external user directories (e.g., LDAP or Active Directory)
“Jenkins is easy to customize. You can create your own plugin if you have basic experience in Java and install this plugin with a couple of clicks using the Jenkins web UI.”
Underrated plugins for Jenkins
After that, Andrei brought up some non-standard Jenkins features that come as plugins and are useful for development.
E.g., Snippet Generator is a tool within Jenkins that enables users to generate code for individual steps and discover steps provided by plugins. Snippet Generator also helps users to experiment with particular steps by using different parameters.
Another example of Jenkins’s neglected feature is Blue Ocean. It is a visual editor that allows for modifying pipelines as code. Blue Ocean has native integration for branch and pull requests. It also shows which portion of the pipeline needs fixing in case of errors.
Other than Blue Ocean, Jenkins also has additional solutions for debugging pipeline code. One of these tools is Command-line Pipeline Linter, which allows developers to check and validate pipeline files. Jenkins also has the Replay function for editing the pipeline after a build failure.
Jenkins has also been updated to include Multibranch Pipeline capability. “The multibranch workflow automatically takes the pipeline files from the old branch available in the repo and creates a separate test for each of the branches,” explained Andrei. “You don’t need to configure each of the new branches separately in the new Jenkins.”
This is complemented by the Organization Folders feature, which makes Jenkins monitor a GitHub organization and automate pull requests.
Containers of choice
According to Andrei, the three most common containers used in conjunction with Jenkins are Docker, Kubernetes, and Apache Mesos. Using containers, resources such as CPU and memory can be isolated and configured based on priority. More importantly, each build automatically creates its own container.
Of the three containers, Docker is probably the preferred option—due to its ease of use. “If you need a tool to be available during your build process, you just need to modify your Docker file,” explained Andrei. “You need to add a couple of lines to install your favorite Ruby, Python, or Go version.”
For users working with Docker, this tile for PCF automates Jenkins follower provisioning, as well as resolves high availability issues through BOSH deployments. In addition to integrated monitoring and logging, the Jenkins tile also allows users to choose when to upgrade and what versions of software should be used when the new instances are created.
In a nutshell, the Jenkins tile for PCF allows for:
- Bootstrapping new Jenkins followers, already preconfigured to work with a Jenkins master
- Enhancing release engineering through automated CI/CD
- Resolving HA issues in default Jenkins installations via BOSH deployments
During his presentation, Andrei demonstrated many of the Jenkins tools mentioned above.
Want details? Watch the video!
Table of contents
- The Ecosystem of PCF Tiles: Easier Deployment and Upgrades
- How to Install Jenkins CI on Cloud Foundry for Continuous Delivery
About the expert
with assistance from Andrei Krasnitski and Alex Khizhniak.