I think I have found a bug in script evaluation. I'm trying to do some more complex computation in a scripted parameter: I have a step with a computed value for the repeat parameter. The below scripts are made up to illustrate the bug:
If I set this to the repeat parameter:
${groovy: def sum = 0; def values=[1,2,3]; for (int i : values) sum += i; if (sum < 6) { return "a" \} else return "b" }
then the script works as expected (I get a single run with "b" as the parameter).
However as soon as I try to add curly braces around the loop block in there like this:
${groovy: def sum = 0; def values=[1,2,3]; for (int i : values) { sum += i; \} if (sum < 6) { return "a" \} else return "b" }
execution breaks with the following error message:
ERROR - Step 'master>Clean Build Storage (Steps)' is failed: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
script14668208906131000868311.groovy: 1: expecting EOF, found 'if' @ line 1, column 70.
int i : values) { sum += i; } if (sum <
^
This seems to happen with any kind of block (for loop, each, generic closures) except for the if/else blocks.