-
Bug
-
Resolution: Fixed
-
Minor
-
None
This Groovy code doesn't print all items:
// @NonCPS def printList(params) { println params params.split(",").each { param -> println "Param: ${param}" } } text = "Foo,Bar,Baz,Qux" printList(text)
Here is the output of non-sandboxed job:
[Pipeline] echo Foo,Bar,Baz,Qux [Pipeline] echo Param: Foo [Pipeline] End of Pipeline
The above code works as expected when invoking using `groovy` command as shown below, but not in Jenkins.
$ groovy test.groovy Foo,Bar,Baz,Qux Param: Foo Param: Bar Param: Baz Param: Qux
In Jenkins the code works as expected only when adding @NonCPS method.
I don't understand why @NonCPS is needed. This sounds like a bug for me.