I'm new to Groovy and the Workflow plugin, so perhaps this is something
obvious. I'm trying to create a set of threads to run in parallel, each
one calling a parameterized job. If I do this, it works:
def paramnodes = [:]
paramnodes['alpha'] = {
node() {
build job: 'parameterized-build-job'
}
}
paramnodes['beta'] = {
node() {
build job: 'parameterized-build-job'
}
}
parallel paramnodes
But if I do something like this, it hangs:
def nodes = [:]
nodes['alpha'] = [
'OPT': 'alpha',
]
nodes['beta'] = [
'OPT': 'beta',
]
@NonCPS
def paramNodes(nodemap) {
def ret = [:]
for (key in nodemap.keySet()) {
ret[key] = {
node() {
build job: 'parameterized-build-job'
}
}
}
return ret
}
def paramnodes = paramNodes(nodes)
parallel paramnodes
The loop has been buried inside a function annotated with @NonCPS to avoid
the problem with for loops on maps not being serializable.
What am I doing wrong? Is there another (supported) way to loop across a
Groovy map to accomplish the same thing?
thanks,
--Andrew
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/47bf0902-4930-4ebd-86c7-54baa680b0ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.