Skip to content

Instantly share code, notes, and snippets.

@gibfahn
Created October 31, 2017 16:02
Show Gist options
  • Save gibfahn/02221043ee5fce85e33d24794a47731c to your computer and use it in GitHub Desktop.
Save gibfahn/02221043ee5fce85e33d24794a47731c to your computer and use it in GitHub Desktop.
citgm-continuous-integration-pipeliner
println "\n### BUILD PARAMETERS ###"
def pr = [] // Mutable parameter set to pass to jobs. I know this is crazy.
String printParams = '' // String of params to print
for (param in params) {
printParams += param.toString() + '\n'
if (param.key != 'NODE_VERSIONs') {
pr.push(string(name: param.key, value: param.value))
}
}
println printParams
stage('Test citgm') {
def versions = params['NODE_VERSIONs'].split()
def buildJobs = [:]
for (int i = 0; i < versions.length; i++) {
int index = i // locally scoped copy.
def p = pr.collect() // local copy of params
p.push(string(name: 'NODE_VERSION', value: versions[index]))
buildJobs["${versions[index]}"] = { build(job: 'citgm-continuous-integration', parameters: p) }
}
println buildJobs
parallel(buildJobs)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment