How to make Pipeline job to wait for all triggered parallel jobs?
You should use pipeline parallel expression, which will wait for all spawned jobs / subtasks to complete:
stage('testing') {
def branches = [:]
for(i = 0; i < params.size(); i += 1) {
def param = params[i]
branches["Test${i}"] = {
build job: 'Test', parameters: [string(name: 'Name', value: param)], quietPeriod: 2
}
}
parallel branches
}
You can find some more examples in pipeline docs at jenkins.io
Just run into the same problem, and find a working solution. Just use foreach.
stage('testing') {
def jobs = [:]
[1,2,3,4,5].each{
i -> jobs["Test${i}"] = {
build job: 'Test',
parameters: [string(name: 'theparam', value: "${i}")],
quietPeriod: 2
}
}
parallel jobs
}