Hello Robin
I've encountered a problem, where I try to append certain information from parallel steps into one variable, so that at the end I can use one variable to display all that I collected.
I have the step structure as follows:
[parallel 1] [parallel 2] [parallel 3]
sequential sequential sequential
Three parallel groups run on three different agents.
Inside the sequential steps, they consist of pretty much the same set of steps (that kind that you modify one of them and it will reflect on all three sequential steps)
And one of the steps in sequential is publish JUnit report, in "post action scripts" I have:
groovy:
// append failed names to Email body if there are failures:
if (current.errors + current.failures > 0) {
def failed_pkg = params.get('release_name')
logger.warn(' ********* add ' + failed_pkg + ' to Email body **********')
if (vars.getValue('test_failed_packages') == 'null') {
logger.warn('variable is still null')
vars.get('test_failed_packages').setValue(failed_pkg)
}
else
vars.get('test_failed_packages').setValue(vars.getValue('test_failed_packages') + '\n' + failed_pkg)
}
As you can see I added a line to output if the variable is still null (I set the variable to null in the beginning of the build)
And where there are failures in all three agents, the log will all say "variable is still null". And the final value will be overridden by the last parallel that executed the step.
I wonder if I used the wrong way to achieve what I intended. How could you modify the same variables and save the values on the go?
Thank you!!
- solved #8
- replies 7
- views 921
- stars 0