I am using the build flow plugin to run tasks in parallel in Jenkins. Initially it was this that works:
parallel (
{ build("jobX", param: params["inputVal1"])
},
{build("jobX", param: params["inputVal2"])
}
)
However, my need now requires me to write this in some kind of loop since the number of jobs is dynamic. I want to do something like this (conceptually):
parallel
(
for(int i=1; i<=numOfJobs; i++)
{
build("jobX", param: params["inputVal" + i])
}
)
There is an answer provided in Jenkins Buildflow plugin: how to make variable numbers of jobs in parallel?, but it does not suit my need exactly.
parallel numJobs.each { index -> { -> build("jobX", param: params["inputVal" + index]) } }
. But this does not work either. Could you help with the syntax here? – naspras