mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
16 lines
586 B
Groovy
16 lines
586 B
Groovy
|
void call(script, Map closures, Boolean parallelExecution, String label = "closures") {
|
||
|
handlePipelineStepErrors(stepName: 'runClosures', stepParameters: [script: script]) {
|
||
|
echo "Executing $label"
|
||
|
if (parallelExecution) {
|
||
|
echo "Executing $label in parallel"
|
||
|
parallel closures
|
||
|
} else {
|
||
|
echo "Executing $label in sequence"
|
||
|
def closuresToRun = closures.values().asList()
|
||
|
for (int i = 0; i < closuresToRun.size(); i++) {
|
||
|
(closuresToRun[i] as Closure)()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|