19 September 2019
James Massardo, creator of the library mentioned in this post, has previously created a short tutorial describing the steps to take to create a minimum viable pipeline using his Jenkins Library. I think it’s worth going through it again just to get this information circulated again.
This pipeline is extremely versatile, takes no time to set up, and works remarkably well for a basic pipeline. It’s easy to change and push those changes out to the larger group of Chef Users within your organization, and it doesn’t require them to do or update anything. When managing multiple groups using Chef, this is a pretty handy ability and saves a ton of leg work.
First, fork this repo.
Once forked, you can start making changes. The first changes you will inevitably want to make will be to the pipeline itself, which is stored in the project under
vars/promoteCookbook.groovy. It is here where you can define steps you would like for your cookbook to go through before it is uploaded to your Chef server.
To have a minimum viable pipeline, you will need to at the very least have Lint, Unit, and Syntax checking. This library gives you that by default. Make this pipeline work for your organization.
Once you are satisfied with your changes, commit those to your version control system. Then, check out the README – you will need to follow these directions to get the library installed into your jenkins instance.
When you make changes to this pipeline, all cookbooks will pick them up the next time it runs through as long as your changes to Chef-Jenkins-Library are commited to the master branch.
When testing this pipeline, it is easiest to set up another custom library in jenkins pointing to a dev or test branch of the Chef-Jenkins-Library project. Then, have a test cookbook that points to the “test” library.