Hi Everyone,
First of all, I want to say that I'm really enjoying the workflow plugin. Thanks for all the effort in bringing this feature to production. Specially loading the DSL file from a git repository allows us to auto-test our changes to a job through the same mechanism that we test changes to the code (using Gerrit).
I'm currently encountering some weird behavior when generating a list of tests parallel branches dynamically. I've boiled it down to the following small test case that you can paste into the workflow script box:
@NonCPS
def generateTestBranches (testList) {
def branches = [:]
for (testName in testList.split()) {
branches[testName] = {
echo testName
sleep 20
}
}
return branches
}
def runTests (testList) {
def testBranches = generateTestBranches(testList)
parallel testBranches
}
runTests "test1 test2"The output of this job (it can't be aborted):
Running: Execute sub-workflows in parallel : Start
[test1] Running: Parallel branch: test1
Aborted by anonymous
Aborted by anonymous
Aborted by anonymous
I've also tried replacing the "parallel testBranches" with a simple loop to execute the closures in the map manually (my understanding is that map.each is broken atm so I used a loop instead):
for ( test in testBranches) {
echo "executing ${test.key}"
test.value()
}
And the output is as follows (note that it prints test2 instead of test1 from inside the closure):
Started by user anonymous
Running: Print Message
executing test1
Running: Print Message
test2
Running: Print Message
executing test2
Running: Print Message
test2
Running: End of Workflow
Finished: SUCCESS
I'm not a Groovy expert (I just started learning for the workflow plugin), so I might be doing something dumb here. I'm trying to read the groovy docs to figure out if the way I'm generating the closure is an issue. But overall the state the system gets into seems to be pretty bad (can't abort the job). So I wanted to send out an email here just in case this is a problem with the Jenkins groovy core.
Thanks again for the constant improvements to the workflow plugin.
Regards,
Andres