Trying to create a Jenkins declarative pipeline that runs two stages in parallel, one for each project in a separate folder in the same repo. For each project, we run multiple stages, which are generated using a global variable 'buildProject'. We pass in folder1 and folder2 into the different invocations of buildProject, but due to possible race condition, the same folder is used to run almost all the stages, except for the first sequential stage in the first parallel stage.
The pipeline is as follows:
And vars/buildProject.groovy is:
Expected to see that folder1 is printed in echo statements and stage names for first stage of the parallel stages, where as folder2 is printed in the second of the parallel stages.
Actual behavior is that folder1 is printed only for the first sequential stage name of the first parallel stage. Rest all use and print folder2.
See attached screen shot (Screen Shot 2018-10-15 at 5.32.56 PM.png) and log.txt for the actual execution results.