false
true
1
true
false
false
false
*/1 * * * *
false
import hudson.model.*
import hudson.views.*
import au.com.centrumsystems.hudson.plugin.buildpipeline.*
def repositories = ["repo1", "repo2", "repo3", "repo4"]
def branches = ["branch1", "branch2", "branch3", "branch4"]
repositories.each { repository ->
branches.each { branchName ->
job("${repository}_${branchName}_build") {
deliveryPipelineConfiguration('Build')
configure { project ->
project / 'properties' / 'jenkins.advancedqueue.priority.strategy.PriorityJobProperty' {
useJobPriority(true)
priority(5)
}
}
wrappers {
colorizeOutput()
timestamps()
}
publishers {
downstreamParameterized{
trigger("${repository}_${branchName}_unit-test,${repository}_${branchName}_push") {
condition('SUCCESS')
parameters {
predefinedProp('GIT_URL', "https://bitbucket.org/organisation/${repository}")
predefinedProp('GIT_COMMIT', '${GIT_COMMIT}')
currentBuild()
}
}
}
}
}
job("${repository}_${branchName}_unit-test") {
deliveryPipelineConfiguration('Unit-test')
configure { project ->
project / 'properties' / 'jenkins.advancedqueue.priority.strategy.PriorityJobProperty' {
useJobPriority(true)
priority(4)
}
}
parameters {
stringParam('GIT_URL')
stringParam('GIT_COMMIT')
}
wrappers {
colorizeOutput()
timestamps()
}
publishers {
archiveJunit('test-reports/*.xml')
}
}
job("${repository}_${branchName}_push") {
configure { project ->
project / 'properties' / 'jenkins.advancedqueue.priority.strategy.PriorityJobProperty' {
useJobPriority(true)
priority(3)
}
}
deliveryPipelineConfiguration('Push')
parameters {
stringParam('GIT_URL')
stringParam('GIT_COMMIT')
}
wrappers {
colorizeOutput()
timestamps()
}
publishers {
downstreamParameterized{
trigger("${repository}_${branchName}_deploy") {
condition('SUCCESS')
parameters {
predefinedProp('GIT_URL', "https://bitbucket.org/organisation/${repository}")
predefinedProp('GIT_COMMIT', '${GIT_COMMIT}')
currentBuild()
}
}
}
}
}
job("${repository}_${branchName}_deploy") {
deliveryPipelineConfiguration('Deploy')
configure { project ->
project / 'properties' / 'jenkins.advancedqueue.priority.strategy.PriorityJobProperty' {
useJobPriority(true)
priority(1)
}
}
parameters {
stringParam('GIT_URL')
stringParam('GIT_COMMIT')
}
environmentVariables {
env('REPOSITORY', repository)
env('BRANCH', branchName)
}
wrappers {
colorizeOutput()
timestamps()
}
}
}
deliveryPipelineView(repository) {
allowRebuild(true)
allowPipelineStart(true)
showAggregatedPipeline(false)
pipelineInstances(1)
pipelines {
regex(/(${repository}_[^_]+)_build/)
}
sorting(Sorting.TITLE)
}
}
true
false
DELETE
DELETE
JENKINS_ROOT
xterm