Search code examples
jenkinsjenkins-pipeline

Jenkins pipeline fails after upgrade (SandboxTransformer.forbidIfFinalizer)


Recently upgraded our installation of Jenkins (from 2.142 to 2.187, IIRC), but after the upgrade all pipelines - even the simple ones - fail constantly.

Otherwise no alerts from the system - everything looks as if it working correctly. But after the upgrade, every pipeline obtains the Jenkinsfile, and fails with:

java.lang.NoSuchMethodError: org.kohsuke.groovy.sandbox.SandboxTransformer.forbidIfFinalizer(Lorg/codehaus/groovy/ast/MethodNode;)V
at com.cloudbees.groovy.cps.SandboxCpsTransformer.visitMethod(SandboxCpsTransformer.java:72)
at com.cloudbees.groovy.cps.CpsTransformer.call(CpsTransformer.java:132)
at com.cloudbees.groovy.cps.SandboxCpsTransformer.call(SandboxCpsTransformer.java:29)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:320)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)

Anyone seen this issues before and knows how to fix it?

Edit (Even a basic hello world pipeline script fails, so it's not the scripts).

Updated to v2.189 and all plugins to the latest, and it's still failing.


Solution

  • As commented above, the issue was with the Script Security Plugin. Fixed this by massaging the configurations and settings a bit. Suspect the issue was caused by prior security hardening tweaks not playing nice with the new plugin rules.