Mark Waite Here is a use-case for you. See the multi-lined comment areas below. Is there any ideas to achieve something similar?? We need to run an external pipeline script which lives in a scripts repository, because we don't want to put our shared pipeline scripts in 900+ chef module repositories or use submodules. We've hit a brick wall for our use case since updating Job DSL 1.70 to 1.74 since pipelineJob is dead for supporting SCM. multibranchPipelineJob is lacking multi git functionality.
// Generate PR push pipeline jobs for all of the repos passed in via REPO_LISTdef repoList = "${REPO_LIST}".trim().replaceAll('"', '').split(",")
println "Generating PR push jobs for the following repos:: $repoList"
repoList.each {
def cookbook = it
multibranchPipelineJob("chef-${cookbook}-PR-push") {
description("Chef push pipeline job")
branchSources {
github {
buildOriginPRHead() // Build fork PRs (unmerged head).
// buildOriginPRMerge() // Build fork PRs (merged with base branch).
buildOriginBranchWithPR() // Build origin branches also filed as PRs.
checkoutCredentialsId('fffff-fffff-fffff-fffff')
// scanCredentialsId('github-ci')
repoOwner('myOwner')
repository("${cookbook}")
}
}
configure {
// my Jenkinsfile doesn't exist in the chef coookbooks for 900 repositories...
// how can we set a seperate git repo for shared scripts?
// https://stackoverflow.com/questions/48284589/jenkins-jobdsl-multibranchpipelinejob-change-script-path
it / factory(class: 'org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory') {
owner(class: 'org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject', reference: '../..')
scriptPath("jenkins/[where ever you want]/Jenkinsfile")
}
}
}
}
pipelineJob worked excellent for our needs, the old broken syntax is below:
repoList.each {
def cookbook = it
pipelineJob("chef-${cookbook}-PR-push") {
definition {
cpsScm {
lightweight(true)
scriptPath('jenkins/[where ever you want]/Jenkinsfile')
scm {
git {
branch('master')
remote {
github("organization/scripts", 'ssh')
credentials('ffff-fff-fff-ffffff)
}
}
}
}
}
}
}
|