-
Bug
-
Resolution: Unresolved
-
Critical
-
None
-
Jenkins 2.170, workflow-cps-plugin 2.65
String test() { println("test") return "12345" } def testtest(String b = test()) { println("testtest") } testtest() println ("END")
This script produces the following:
[Pipeline] Start of Pipeline [Pipeline] echo test [Pipeline] echo END [Pipeline] End of Pipeline Finished: SUCCESS
the ' println("testtest")' is not invoked. Adding @NonCPS annotation is the available workaround:
@NonCPS String test() { println("test") return "12345" } def testtest(String b = test()) { println("testtest") } testtest() println ("END")
produces:
[Pipeline] Start of Pipeline (hide) [Pipeline] echo test [Pipeline] echo testtest [Pipeline] echo END [Pipeline] End of Pipeline Finished: SUCCESS
This doesn't look like a regression - it's reproduced in older versions as well.
[JENKINS-56916] Passing method invocation as another method input default value breaks the second method
Description |
Original:
{code:java} String test() { println("test") return "12345" }def testtest(String b = test()) { println("testtest") }testtest() println ("END"){code} This script produces the following: {noformat} [Pipeline] Start of Pipeline [Pipeline] echo test [Pipeline] echo END [Pipeline] End of Pipeline Finished: SUCCESS {noformat} the ' println("testtest")' is not invoked. Adding @NonCPS annotation is the available workaround: {code:java} @NonCPS String test() { println("test") return "12345" }def testtest(String b = test()) { println("testtest") }testtest() println ("END") {code} produces: {noformat} [Pipeline] Start of Pipeline (hide) [Pipeline] echo test [Pipeline] echo testtest [Pipeline] echo END [Pipeline] End of Pipeline Finished: SUCCESS {noformat} This doesn't look like a regression - it's reproduced in older versions as well. |
New:
{code:java} String test() { println("test") return "12345" } def testtest(String b = test()) { println("testtest") } testtest() println ("END"){code} This script produces the following: {noformat} [Pipeline] Start of Pipeline [Pipeline] echo test [Pipeline] echo END [Pipeline] End of Pipeline Finished: SUCCESS {noformat} the ' println("testtest")' is not invoked. Adding @NonCPS annotation is the available workaround: {code:java} @NonCPS String test() { println("test") return "12345" } def testtest(String b = test()) { println("testtest") } testtest() println ("END") {code} produces: {noformat} [Pipeline] Start of Pipeline (hide) [Pipeline] echo test [Pipeline] echo testtest [Pipeline] echo END [Pipeline] End of Pipeline Finished: SUCCESS {noformat} This doesn't look like a regression - it's reproduced in older versions as well. |