Deploying Jenkins with Puppet and Dependency Challenges
By Ralph Reid, Automation Consultant, Kovarus
Recently, I saw R. Tyler Croy’s talk on the Jenkins’s project experience using Puppet to provision their infrastructure. It really inspired me to explore using Puppet to provision Jenkins servers. The Jenkins Puppet module from the forge deployed without any issues. Standard invocation of the module successfully installed the plugins.
The problem occurs when one attempts to install GitHub. Unlike the AnsiColor Plugin above, the GitHub plugin requires other dependent plugins. A good place to identify dependencies is on the Jenkins wiki. For example, the GitHub plugin can be found at: https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Plugin:
Unfortunately, the Puppet module rtyler-jenkins does not automatically install Jenkins dependencies.
One approach would be to follow each link to each dependent plugin. Then, identify the overall dependency tree. This is definitely a viable approach but could be rather time consuming.
One Solution: Install using the Jenkins Admin Interface. Capture the dependent plugin notifications. Use captured notifications as source for the desired plugins provision configurations.
Just as one expects, the installation of the GitHub plugin kicked off in the GUI, lists many more required plugins than just the five listed on the GitHub Plugin page. In fact, it lists 13 dependent plugins, whereas as the GitHub plugin page itself suggests only five dependent plugins.
Like many things, I took a few wrong turns before I realized the dependencies were not being fully installed by the Puppet module. No problem here as the module documentation clearly indicates that plugin dependencies are not automatically installed. Perhaps there is a future opportunity to extend the Puppet module in the future.
However, it is possible to use the captured 13 required plugins installed through the GUI to build the Puppet configurations. Here is a sample of two of the Jenkins plugins that are dependencies of the GitHub plugin.
Some use cases will require that the version is pinned or specifically referenced. In order to determine the version, look at the specific plugin Jenkins wiki page. Another approach is to view the installed plugin page within the Jenkins Admin Interface.
In the future, I suggest looking at utilizing the jenkins-cli command list-plugins.
Standard Jenkins installations can include Jenkins CLI. It’s very useful and the complete list of commands can be accessed at the terminal or even under the Manage Jenkins menu. Here is an example from the Jenkins’s Manage Jenkins menu:
There is another approach to determine plugins dependencies. If you like the command line, consider using the list-plugins command to find the list of dependent plugins installed. To do this, simply run this command before kicking off the installation (using the GUI) of the target plugin. Send the output of this command to a file, then kick off the installation. Next, execute the list-plugins command again. Depending on your preference, you may redirect the output to another file and simply compare the two files.
The unique differences between these two files are the Jenkins plugin dependencies to be named and managed in your Puppet modules.