I\'ve Groovy script as part of the Pipeline job in Jenkins as below:
node {
stage(\'Testing\') {
build job: \'Test\', parameters: [string(name: \
However @agg3l's example is not working with multiple jobs.
Map jobResults = [:]
Boolean failedJobs = false
def buildJobWithParams(def jobs_list, Map results) {
def branches = [:]
for(job in jobs_list)
{
print job
branches["Test-${job}"] = {
def jobBuild = build job: job, propagate: false
def jobResult = jobBuild.getResult()
echo "Build of '${job}' returned result: ${jobResult}"
results[job] = jobResult
}
}
return branches
}
stage('Run integration tests') {
steps {
def job_branch = buildJobWithParams(item_list, jobResults)
print job_branch
parallel job_branch
}
}
The item_list has more than 1 job, however it will execute only last job multiple times.