Hi All,

Can please help me on how to achieve concurrency using groovy script in 
Jenkins freestyleproject?.

I have tried to execute below script. But I am getting the following error 
"Caught: 
groovy.lang.MissingMethodException: No signature of method: main.parallel() 
is applicable for argument types: (java.util.LinkedHashMap) values: 
[[job1:main$_run_closure1$_closure2@776aec5c, 
job2:main$_run_closure1$_closure2@1d296da, ...]]
groovy.lang.MissingMethodException: No signature of method: main.parallel() 
is applicable for argument types: (java.util.LinkedHashMap) values: 
[[job1:main$_run_closure1$_closure2@776aec5c, 
job2:main$_run_closure1$_closure2@1d296da, ...]]
at main.run(main.groovy:23)" Script def jobsString = "job1,job2,job3"
ArrayList jobsList = jobsString.split('\\,')

def parallelJobs2Run = [:]
jobsList.each { job ->
    echo "Going to parallel for job ${job}"
    parallelJobs2Run["${job}"] = { ->
        echo "Calling job ${job}"
        jobResults=build job: "${pathJenkinsFolder}${job}",
        parameters: [
            string(name: 'param1', value: "${value1}"),
            string(name: 'param2', value: "${value2}")
        ],
        propagate: true,
        wait: true

        buildNumber = ${jobResults.number}
        echo "${job} Build number |${buildNumber}| result: 
|${jobResults.result}|"
        echo "See details on: |${jobResults.absoluteUrl}|"
    }
};
parallel parallelJobs2Run


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/cdbeb3d5-923e-42ac-a9f6-26cd79c2728e%40googlegroups.com.

Reply via email to