Upload
buidiep
View
251
Download
0
Embed Size (px)
Citation preview
Jenkins User Conference Europe #jenkinsconf
Configuration As Code The Job DSL Plugin Daniel Spilker CoreMedia www.coremedia.com June 25, 2014
#jenkinsconf
Jenkins User Conference Europe #jenkinsconf
Current Situation
• No single job that builds everything • Each branch needs its own pipeline • Every team has their own jobs
Jenkins User Conference Europe #jenkinsconf
Problem
• Lots of copy&paste • Editing in HTML text areas • Settings hidden behind Advanced button • Working with the UI can be slow
Jenkins User Conference Europe #jenkinsconf
Configuration As Code
• Create new pipelines quickly • Refactor jobs • Trace changes • Work with your favorite tool set
Jenkins User Conference Europe #jenkinsconf
There Is A Plugin For That
• Template Project Plugin • Job Generator Plugin • Literate Plugin • JobConfigHistory Plugin • …
• Job DSL Plugin Open Icon Library / CC BY 3.0
Jenkins User Conference Europe #jenkinsconf
Job DSL Language
job { name('job-dsl-plugin-folders') scm { github('daspilker/job-dsl-plugin', 'folders') } triggers { githubPush() } steps { gradle('clean build') } publishers { archiveArtifacts('**/job-dsl.hpi') } }
Jenkins User Conference Europe #jenkinsconf
Job DSL Language
job { name('job-dsl-plugin-folders') scm { github('daspilker/job-dsl-plugin', 'folders') } triggers { githubPush() } steps { gradle('clean build') } publishers { archiveArtifacts('**/job-dsl.hpi') } }
Jenkins User Conference Europe #jenkinsconf
Job DSL Language
job { name('job-dsl-plugin-folders') scm { github('daspilker/job-dsl-plugin', 'folders') } triggers { githubPush() } steps { gradle('clean build') } publishers { archiveArtifacts('**/job-dsl.hpi') } }
Jenkins User Conference Europe #jenkinsconf
Job DSL Language
job { name('job-dsl-plugin-folders') scm { github('daspilker/job-dsl-plugin', 'folders') } triggers { githubPush() } steps { gradle('clean build') } publishers { archiveArtifacts('**/job-dsl.hpi') } }
Jenkins User Conference Europe #jenkinsconf
Job DSL Language
job { name('job-dsl-plugin-folders') scm { github('daspilker/job-dsl-plugin', 'folders') } triggers { githubPush() } steps { gradle('clean build') } publishers { archiveArtifacts('**/job-dsl.hpi') } }
Jenkins User Conference Europe #jenkinsconf
Job DSL Language
job { name('job-dsl-plugin-folders') scm { github('daspilker/job-dsl-plugin', 'folders') } triggers { githubPush() } steps { gradle('clean build') } publishers { archiveArtifacts('**/job-dsl.hpi') } }
Jenkins User Conference Europe #jenkinsconf
Job DSL Plugin
• Install Job DSL Plugin • Create free-style project • Add “Source Code Management” • Add “Process Job DSL” build step • Configure scripts • Run job
Jenkins User Conference Europe #jenkinsconf
Job DSL Plugin
• Install Job DSL Plugin • Create free-style project • Add “Source Code Management” • Add “Process Job DSL” build step • Configure scripts • Run job
Jenkins User Conference Europe #jenkinsconf
Job DSL Plugin
• Install Job DSL Plugin • Create free-style project • Add “Source Code Management” • Add “Process Job DSL” build step • Configure scripts • Run job
Jenkins User Conference Europe #jenkinsconf
Job DSL Plugin
• Install Job DSL Plugin • Create free-style project • Add “Source Code Management” • Add “Process Job DSL” build step • Configure scripts • Run job
Jenkins User Conference Europe #jenkinsconf
Job DSL Plugin
• Install Job DSL Plugin • Create free-style project • Add “Source Code Management” • Add “Process Job DSL” build step • Configure scripts • Run job
Jenkins User Conference Europe #jenkinsconf
Job DSL Plugin
• Install Job DSL Plugin • Create free-style project • Add “Source Code Management” • Add “Process Job DSL” build step • Configure scripts • Run job
Jenkins User Conference Europe #jenkinsconf
Job DSL Plugin
• Install Job DSL Plugin • Create free-style project • Add “Source Code Management” • Add “Process Job DSL” build step • Configure scripts • Run job
Jenkins User Conference Europe #jenkinsconf
Batteries Included
EnvInject
Groovy
Copy Artifact
Git Subversion
Folders
Extra Columns
StashNotifier
Maven Deployment Linker
Gradle
Build Pipeline
Workspace Cleanup
GitHub Pull Request Builder
GitHub
Multiple SCMs
JaCoCo Release
Build Flow Robot Framework
Tool Environment
Conditional BuildStep
Throttle Concurrent Builds
Associated Files
JSHint Checkstyle
Emma
Xvnc
Prerequisite Build Step
AnsiColor
Timestamper
Text-Finder Job DSL Perforce
Ant
Maven Project
Jenkins User Conference Europe #jenkinsconf
Extending The DSL
Jenkins User Conference Europe #jenkinsconf
Extending The DSL
Jenkins User Conference Europe #jenkinsconf
Extending The DSL
job {
...
configure { project ->
project / buildWrappers << EnvInjectPasswordWrapper {
injectGlobalPasswords(true)
}
}
}
Jenkins User Conference Europe #jenkinsconf
Everything is Groovy
@Grab(…) … gitHub.user('daspilker').repos.each { repo -> repo.branches.each { branch -> job { name("${repo.name}-${branch.name}") scm { github(repo.name, branch.name) } … } } }
Jenkins User Conference Europe #jenkinsconf
Further Information
• Documentation https://github.com/jenkinsci/job-dsl-plugin/wiki
• Examples
https://github.com/sheehan/job-dsl-gradle-example
• Playground http://job-dsl.herokuapp.com/
• Mailing List
https://groups.google.com/forum/?fromgroups#!forum/job-dsl-plugin
Jenkins User Conference Europe #jenkinsconf
Corporate Community
Thank You To Our Sponsors Platinum Gold
Silver
Jenkins User Conference Europe #jenkinsconf
Thank You Daniel Spilker [email protected] @daspilker We‘re hiring www.coremedia.com @CoreMediaMinds