Jenkins as a Code - leveraging Groovy for infrastructure management

Jenkins as a Code - leveraging Groovy for infrastructure management

Jobs in Jenkins (or any other CI/CD tool) can be created and updated manually using GUI. It is ok if you have a few/several of them. However, most of the companies grow and you can quickly wake up with dozens or hundreds of jobs to maintain.

A new email address/alias to get notification about failed builds? Global migration to the better™ SCM? No way to do it manually with GUI in a convenient way. Manual scripts using Jenkins API? Better, but hard to test and maintain. The same applies to plugin installation, credentials etc. Luckily, there is a better way.

During the talk we will present how Jenkins Job DSL together with Ansible can be used to automatically provision Jenkins instance and maintain any number of jobs. We will show how to define jobs and views in Groovy based DSL and test automatically that the generated structures are exactly the same as expected in Jenkins. Expect live demo - we will setup fully functional Jenkins instance with just one click!

Co-presented with Łukasz Szczęsny.


Marcin Zajączkowski

March 19, 2016