Parallel buildflow inside of nested loops (or outside)

17 views
Skip to first unread message

Darren Ball

unread,
Apr 15, 2016, 11:56:10 AM4/15/16
to Jenkins Users
Hi,

I have a need to run a guarded flow in parallel.  I have a flow similar to the following, of which I need the guarded logic to run in parallel.


Flow:

def executiongate=params['GATEEXECUTION']
def testcases=params['TESTCASES'].tokenize(",")
def outerInstanceType = params['outerInstanceType'].tokenize(",")
def outerInstanceCapacity = params['outerInstanceCapacity'].tokenize(",")
def innerInstanceType = params['innerInstanceType'].tokenize(",")
def innerInstanceCapacity = params['innerInstanceCapacity'].tokenize(",")
def dbInstanceType = params['dbInstanceType'].tokenize(",")
def dbInstanceSize = params['dbInstanceSize'].tokenize(",")


outerInstanceType
.collect { outerType ->
      outerInstanceCapacity
.collect { outerCapacity ->
            innerInstanceType
.collect { innerType ->
                  innerInstanceCapacity
.collect { innerCapacity ->
                        dbInstanceType
.collect { dbType ->
                              dbInstanceSize
.collect { dbSize ->
                                  guard
{
                                      build
("Job1",
                                            outerInstanceType
: outerType,
                                            outerInstanceCapacity
: outerCapacity,
                                            innerInstanceType
: innerType,
                                            innerInstanceCapacity
: innerCapacity,
                                            dbInstanceType
: dbType,
                                            dbInstanceSize
: dbSize)


                             
                                      buildClosures
= []
                                       testcases
.collect { testcase ->
                                       
def curClosure = {
                                            ignore
(FAILURE) {
                                              build
(executiongate,
                                                TESTCASE
: testcase
                                               
)
                                           
}
                                       
}
                                        buildClosures
.add(curClosure)
                                   
}
                                   
                                    parallel
(buildClosures)
                                   
                                 
} rescue {
                                      build
( "Cleanup")
                   
                                 
}
                             
}
                       
}
                 
}
           
}
     
}
}

Any help with this would be great.  As I can't figure out how to introduce parallel to this scenario.

Thanks. 
Reply all
Reply to author
Forward
0 new messages