Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JobDsl script to build a simple pipeline.
// 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
You can’t perform that action at this time.