Created
March 5, 2015 09:58
-
-
Save sleroy/21d359c4bb0d30b82fa8 to your computer and use it in GitHub Desktop.
JobDsl script to build a simple pipeline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ici nous allons créer les jobs Jenkins associés au pipeline de déploiement | |
println "Creation of Jenkins Jobs" | |
/** | |
Reference documentation | |
https://github.com/jenkinsci/job-dsl-plugin/wiki/View-Reference | |
https://github.com/jenkinsci/job-dsl-plugin/wiki/Job-DSL-Commands | |
*/ | |
def project = 'Ehour' | |
def branchName = GIT_BRANCH.replaceAll('/','-') | |
def compileJob = "${project}-compile-${branchName}" | |
def unitTestJob = "${project}-unitTests-compile-${branchName}" | |
def sonarJob = "${project}-sonar-${branchName}" | |
def deployJob = "${project}-deploy-${branchName}" | |
job { | |
name compileJob | |
scm { | |
git(GIT_URL, GIT_BRANCH) | |
} | |
steps { | |
maven('clean compile') | |
} | |
} | |
job { | |
name unitTestJob | |
scm { | |
git(GIT_URL, GIT_BRANCH) | |
} | |
steps { | |
maven('clean test install') | |
} | |
} | |
job { | |
name sonarJob | |
scm { | |
git(GIT_URL, GIT_BRANCH) | |
} | |
maven('sonar:sonar deploy') | |
} | |
job { | |
name deployJob | |
scm { | |
git(GIT_URL, GIT_BRANCH) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment