Learn how to practice configuration as code by using the Job DSL plugin for Jenkins. Find out how to organize Job DSL scripts and apply code reuse and refactoring to your Jenkins configuration. This talk will cover advanced techniques for large scale installations and show how to extend the Job DSL for your favorite plugins.
2. #jenkinsconf
Daniel Spilker
• Works for CoreMedia in Hamburg, Germany
• Software Architect on the Engineering Tools Team
• Maintainer of the
– Job DSL Plugin
– Gradle JPI Plugin
7. #jenkinsconf
There Is A Plugin For That
• Template Project Plugin
• Job Generator Plugin
• Literate Plugin
• JobConfigHistory Plugin
• Workflow Plugin
• Job DSL Plugin
• …
Open Icon Library / CC BY 3.0
31. #jenkinsconf
Using Libraries
• Any Java / Groovy library (JARs) can be used
• Download and dependency resolution must be
handled before running the Job DSL build step
• Anything can be used to download the JARs
– Build tools like Gradle
– Repository Connector Plugin
– Shell script with curl or wget
41. #jenkinsconf
IDE Support
• IntelliJ IDEA only
• Use a Gradle build file for configuration
apply plugin: 'groovy'
sourceSets { … }
repositories { … }
dependencies {
compile 'org.jenkins-ci.plugins:job-dsl-core:1.34'
}
47. #jenkinsconf
Credentials Plugin
• Use the Credentials Plugin
for managing credentials
• The essentials plugins can
consume these credentials
(Git, Subversion, …)
• Use the Credentials Binding
Plugin to map credentials to
environment variables
60. #jenkinsconf
Best Practices
• Commit your DSL scripts to SCM
• Do not put plain text credentials in DSL scripts
• Use Groovy code to avoid repetition