As the Puppet and Chef developer communities have matured, there has been an increased emphasis on style and sanity checking, also known as “linting.”
Console-based warnings are great for local development, but since we’re already running all our Puppet code through Jenkins for validation, why not let Jenkins track linting as well? This can be easily accomplished with the Jenkins Warnings plugin and a little bit of set up work.
- First make sure you install the Warnings plugin from the Jenkins “Manage Plugins” page
- Add a special task to your
Rakefilewhich will invoke puppet-lint with a specific log format, as shown here
- Invoke the new Rake task in the build (
- Configure the Jenkins job to look for the puppet-lint warnings
- Run some builds, and enjoy your new puppet-lint reports and trend graphs!
On the build pages you will be able to drill into an overview report such as the one pictured below, hyperlinked to allow you to dig deeper into the specific warnings
On the job page (http://jenkins/job/my-puppet-module) you will also have a cross-build trend graph to give an indication of the trend of warnings as time goes on.
That’s all there is to it! There isn’t any more setup required to get puppet-lint and Jenkins working together nicely. The hardest part of the whole process seems to be resolving all of the warnings and the second hardest part seems to be keeping the warnings at zero as time progresses.
The Warnings plugin allows for a lot more configuration than I’ve covered in this post, so be sure to explore its more “Advanced” options once you’re up and running!