I'm attempting to replicate this functionality from the Build Flow Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin:
parallel (
{
build("job1")
build("job2")
},
{
build("job5")
build("job6")
}
)
I have the following DSL job:
subjob = "test"
subjob2 = "test2"
series1 = []
series2 = []
subjob = []
["job1","job2"].each{ parameter ->
series1.add({build( subjob, param: parameter )})
}
["job5","job6"].each{ parameter2 ->
series2.add({build( subjob2, param: parameter2)})
}
subjob.add(series1)
subjob.add(series2)
parallel( subjob )
My goal is to run one set of jobs 1&2 in series and another set of jobs 5&6 in series, but to run both sets of jobs in parallel. i.e. Job 1 and 5 kick off at the same time, then when job 1 finishes job 2 start and when job 5 finishes job 6 starts.
However, I've tried a number of variations on the above code, but different errors each time. The above code gives the following:
ERROR: Failed to run DSL Script
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '[Script1$_run_closure1$_closure3@3c52c84, Script1$_run_closure1$_closure3@56789ba0]' with class 'java.util.ArrayList' to class 'groovy.lang.Closure' due to: groovy.lang.GroovyRuntimeException: failed to invoke constructor: public groovy.lang.Closure(java.lang.Object,java.lang.Object) with arguments: [Script1$_run_closure1$_closure3@3c52c84, Script1$_run_closure1$_closure3@56789ba0] reason: java.lang.InstantiationException
Is there a better way of doing this?