I have code like the following: (obviously more complicated, but this shows
the problem)
for (int i = 0; i < list.size(); i++) {
thing = list.get(i)
print thing
branches[thing] = {
node {
print thing
}
}
parallel branches
As it's building the branches, it prints out each thing in the list in
order as I would expect. When it actually *executes* the branches, it
prints the last thing in the list for as many items there are in the list.
From what I understand, that's because it's executing the value of the
external variable at the time the job is run, rather than what it was at
the time the branch was built. Which I believe is the correct behavior, so
I'm probably approaching this the wrong way.
What would be the correct way to run several parallel tasks on different
items in a list? Is there a way to built the code block for each branch so
it has the *value* of the variable when I'm building it rather than the
*variable itself*?
--
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/07ff466f-183c-4c16-bdf2-8402e9ecf451%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.