Issue
Since running CloudBees CI with Pipeline: Groovy plugin version 4045.v0efb_cb_7cea_e9 or later installed, build logs show warnings like the one below:
Did you forget the `def` keyword? WorkflowScript seems to be setting a field named isBroken (to a value of type Boolean) which could lead to memory leaks or other issues.
Resolution
This warning will be seen when either your Jenkinsfile or shared library defines a variable without using the def
keyword. Using the example warning from above, we know that a variable isBroken
has been defined like below:
isBroken = true
The solution is to check all pipeline code (Jenkinsfile and shared libraries) to ensure the variables listed in the logs are defined properly:
def isBroken = true
Workaround
Please follow the Resolution section, as the Workaround could lead to memory leaks
|
These warnings can be suppressed by running the below script in the script console of the controller:
System.setProperty("org.jenkinsci.plugins.workflow.cps.LoggingInvoker.fieldSetWarning", "false")
To preserve this between controller restarts, add the following Java argument to the affected controller by following How to add Java arguments to Jenkins?:
-Dorg.jenkinsci.plugins.workflow.cps.LoggingInvoker.fieldSetWarning=false