Inside that global variable a local variable is defined to hold the value of a passed in parameter:
The following code then optionally reassigns the variable if a subset of nodes is wanted (the logic of below is not really important):
And then a bit later that variable is used in a shell command:
If the global variable provisionNodes is run a number of times in parallel from a parallel block in a Jenkinsfile, the nodeString variable is being shared across all running instances in the parallel block such that the last instance to assign nodeString before they all get to the above code block, is setting the value for all instances and they all end up with same argument of nodes to the above shell call.
Is this expected? It's not at all embracing the principle of least surprise if it is. and if it is, how do I get nodesString (and every other variables) local scope back as I would expect it?