-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins 2.150.3
Pipeline 2.6
Trying to follow the Groovy Style Guide's item 9 "Using with() and tap() for repeated operations on the same bean:"
currentBuild.with { result = 'FAILURE' description += "\nFailed in ${stage_name} stage" }
Resulted in:
groovy.lang.MissingPropertyException: No such property: description for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:264)
at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:288)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:292)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29)
...
The workaround is simply:
currentBuild.result = 'FAILURE' currentBuild.description += "\nFailed in ${stage_name} stage"