Previously I’ve written about the Top 10 Must-Have Jenkins Plugins/Features and later about how to conquer job hell and multiple app branches using Jenkins & Mercurial. I showed how to use Jenkins views and a couple of plugins to manage multiple branches with continuous integration.
Today I thought I’ll share some more tips with you. Internally we’ve been using a plugin of Jenkins called Publish HTML Reports and a tool we made and open-sourced called Jenkins Reporter. Combine these two handy plugins and you get easy-to-grasp test reports for your branches. What more could you want in life?
How to publish HTML reports from Jenkins
The idea behind this plugin is easy. Once installed you can configure any job to publish and keep some folder from the job’s workspace that represents a static webpage. For example, your job might generate a report that has a HTML file that gives you an overview of the test results.
Once you have it configured, your job will get an extra link or many (depending how many reports you publish) in the left menu. That link will always take you to the latest report.
We started using Jenkins Views to group all the jobs for a particular VCS branch. At one point, one of our projects had 4 active branches and they each had 20 jobs configured. This started to give me a headache on how to figure out what is the overall status of that branch. If it is not green then what specifically is failing at the moment?
To answer those questions, we wrote a utility called Jenkins Reporter, which goes to a Jenkins View, lists all the jobs and generates a report based on the results. If it finds any failures it will give you all the necessary context needed. It will tell you how many builds have been failing with that failure, and then groups failures based on your matrix settings.
Putting the two together
So, we have a tool that generates reports and a plugin that can aggregate and promote those reports. My next thought is how to create a Jenkins job that goes through the views in Jenkins that designate VCS branches and generate a report for each branch? Also, let’s make sure that this job runs often enough to keep the reports constantly up to date. What we’ve got now is a CI system with more high level reports that shows the health of your VCS branches. This is useful for engineers to get an overview of a status of a branch or to a release engineer who might be prepping a release off of a branch that still needs some issues fixed.
Let me know in the comments section below or on Twitter @toomasr if you found this useful or have any other tips how to manage large number of jobs in Jenkins while not giving up on higher level reports. Btw, RebelLabs has a beautifully-designed PDF report on Jenkins called Jenkins CI – The Origins of Butlers, Build Masters and Bowties. I suggest you check it out. Happy hacking!