[JIRA] (JENKINS-56682) Unable to use @Field annotations

8 views
Skip to first unread message

thetypz@gmail.com (JIRA)

unread,
Mar 22, 2019, 9:26:02 AM3/22/19
to jenkinsc...@googlegroups.com
Francois Ferrand created an issue
 
Jenkins / Bug JENKINS-56682
Unable to use @Field annotations
Issue Type: Bug Bug
Assignee: Unassigned
Components: workflow-cps-plugin
Created: 2019-03-22 13:25
Environment: Jenkins: 2.168
Pipeline: Groovy 2.64
Priority: Critical Critical
Reporter: Francois Ferrand

Since the workflow-cps was upgraded to 2.64, @Field annotations are not working anymore.

The following pipeline works fine in 2.63:

import groovy.transform.Field
@Field final SOMETHING='bar'
@Field final MY_CONSTANT="foo $SOMETHING"
node() {
  do_stuff()
}
def do_stuff() {
  sh "echo $MY_CONSTANT"
}

With workflow-cps 2.64, this gives the following exception:

 

roovy.lang.MissingPropertyException: No such property: SOMETHING for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:58) 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.callStatic(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:230) at WorkflowScript.<init>(WorkflowScript:3) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at java.lang.Class.newInstance(Class.java:442) at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:434) Caused: groovy.lang.GroovyRuntimeException: Failed to create Script instance for class: class WorkflowScript. Reason at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:466) at groovy.lang.GroovyShell.parse(GroovyShell.java:700) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.lambda$doParse$0(CpsGroovyShell.java:135) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:136) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:132) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:560) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:521) 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) Finished: FAILURE
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

thetypz@gmail.com (JIRA)

unread,
Mar 22, 2019, 9:29:02 AM3/22/19
to jenkinsc...@googlegroups.com
Francois Ferrand updated an issue
Change By: Francois Ferrand
Since the workflow-cps was upgraded to 2.64, @Field annotations are not working anymore.

The following pipeline works fine in 2.63:
{code:java}

import groovy.transform.Field
@Field final SOMETHING='bar'
@Field final MY_CONSTANT="foo $SOMETHING"
node() {
  do_stuff()
}
def do_stuff() {
  sh "echo $MY_CONSTANT"
}
{code}

With workflow-cps 2.64, this gives the following exception:

 
{noformat}

roovy.lang.MissingPropertyException: No such property: SOMETHING for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:58)
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.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:230)
at WorkflowScript.<init>(WorkflowScript:3) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at java.lang.Class.newInstance(Class.java:442)
at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:434)
Caused: groovy.lang.GroovyRuntimeException: Failed to create Script instance for class: class WorkflowScript. Reason
at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:466)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.lambda$doParse$0(CpsGroovyShell.java:135)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:136)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:132)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:560)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:521)
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)
Finished: FAILURE
{noformat}

thetypz@gmail.com (JIRA)

unread,
Mar 22, 2019, 9:29:03 AM3/22/19
to jenkinsc...@googlegroups.com
Francois Ferrand updated an issue
Since the workflow-cps was upgraded to 2.64, @Field annotations are not working anymore.

The following pipeline works fine in 2.63:
{code:java}
import groovy.transform.Field
@Field final SOMETHING='bar'
@Field final MY_CONSTANT="foo $SOMETHING"
node() {
  do_stuff()
}
def do_stuff() {
  sh "echo $MY_CONSTANT"
}
{code}
With workflow-cps 2.64, this gives the following exception:

 
{noformat}
roovy Groovy .lang.MissingPropertyException: No such property: SOMETHING for class: groovy.lang.Binding

thetypz@gmail.com (JIRA)

unread,
Mar 22, 2019, 9:30:04 AM3/22/19
to jenkinsc...@googlegroups.com
Francois Ferrand updated an issue
Change By: Francois Ferrand
Environment:
Jenkins: 2.168
Pipeline: Groovy 2.64

script-security: 1.54

trichter@pro-vision.de (JIRA)

unread,
Apr 16, 2019, 7:08:02 AM4/16/19
to jenkinsc...@googlegroups.com
Tobias Richter commented on Bug JENKINS-56682
 
Re: Unable to use @Field annotations

I can confirm this issue with the mentioned versions. We downgraded script-security to 1.53 and workflow-cps to 2.63 to solve this issue.

jglick@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 3:00:04 PM6/4/19
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
 
Change By: Jesse Glick
Labels: regression

dnusbaum@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 3:02:02 PM6/4/19
to jenkinsc...@googlegroups.com
Devin Nusbaum assigned an issue to Devin Nusbaum
Change By: Devin Nusbaum
Assignee: Devin Nusbaum

dnusbaum@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 3:02:03 PM6/4/19
to jenkinsc...@googlegroups.com
Devin Nusbaum started work on Bug JENKINS-56682
 
Change By: Devin Nusbaum
Status: Open In Progress

jglick@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 3:02:03 PM6/4/19
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
Change By: Jesse Glick
Component/s: script-security-plugin
Component/s: workflow-cps-plugin

jglick@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 3:02:04 PM6/4/19
to jenkinsc...@googlegroups.com

dnusbaum@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 3:03:12 PM6/4/19
to jenkinsc...@googlegroups.com
Devin Nusbaum commented on Bug JENKINS-56682
 
Re: Unable to use @Field annotations

I ran into this issue via a report from a customer. Here is a PR that I think will help: https://github.com/jenkinsci/script-security-plugin/pull/259. Still need to understand the scope of what was broken by SECURITY-1336.

Reply all
Reply to author
Forward
0 new messages