1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/vars/runClosures.groovy
Kevin Hudemann fd98d6279f
Add step for end to end test execution (#1786)
This change adds the end to end test execution capabilities of the SAP
Cloud SDK pipeline, i.e., the consumer can define a npm script which is
then executed using the npmExecuteScripts step.

The handling of generated results will be provided in a follow up PR.

Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-07-13 15:10:12 +02:00

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)()
}
}
}
}