parallel() can take a list/map of closures

you will want to do this:

// construct and collect closures for LATER execution
buildClosures = []
for (int i=1; i<100; i++) {
    def curClosure = {
        build("a", STEP:i)
    }
    buildClosures.add(curClosure)
}

// execute the closures in buildClosures in parallel
parallel(buildClosures)


On Saturday, 22 February 2014 02:01:32 UTC-8, dev123 wrote:
>
> Is it possible to create a for loop in the jenkins build flow plugin DSL? 
> Currently I have:
>
> parallel (
> { build( "a", STEP: 1) },
> { build( "a", STEP: 2 ) },
>         { build( "a", STEP: 3 ) }
> )
>
> Which I need to scale to e.g. 100 parallel executions. Therefore I need to 
> be able to do something like:
>
> parallel (
>
>          for (int i=1; 1<100; i++) {
>       { build( "a", STEP: i) }
>         }
> )
>
> But that gives an error.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to