[JENKINS-38268] Parallel step and closure scope - Jenkins JIRA

PHOTO EMBED

Tue Jun 23 2020 08:10:05 GMT+0000 (UTC)

Saved by @givemekey #jenkins

def get_dummy_params(val)
{
    return [string(name: 'dummy', value: "$val")]
}

def create_jobs()
{
    def jobs = [:]
    for (int i=1; i <= 3; i++) {
        def x = i
        jobs["job-$x"] = { -> build([job: "job-$x", parameters: get_dummy_params(x) ]) }
    }
    return jobs
}

stage ('triggering') {
    parallel(create_jobs())
}
content_copyCOPY

https://issues.jenkins-ci.org/browse/JENKINS-38268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel