[JIRA] (JENKINS-37736) $class-less syntax doesn't work as expected for build steps with no-args ctor

2 views
Skip to first unread message

chris@orr.me.uk (JIRA)

unread,
Aug 27, 2016, 6:44:01 AM8/27/16
to jenkinsc...@googlegroups.com
Christopher Orr created an issue
 
Jenkins / Improvement JENKINS-37736
$class-less syntax doesn't work as expected for build steps with no-args ctor
Issue Type: Improvement Improvement
Assignee: Jesse Glick
Components: pipeline
Created: 2016/Aug/27 10:43 AM
Priority: Minor Minor
Reporter: Christopher Orr

Possibly working-as-intended / could be (somehow?) fixed by me in my plugin implementation, but thought I'd mention it…

I upgraded Android Lint to use the @Symbol annotation (which is an excellent feature!), and it has been working great.

However, the class that this applies to, LintPublisher, has a no-args @DataBoundConstructor — if no other parameters are specified, a default file pattern is used.

So I saw that while "androidLint pattern: '**/foo.xml'" works fine, the no-args variant "androidLint" does not work at all, as Pipeline looks for a global binding with that name:

groovy.lang.MissingPropertyException: No such property: androidLint for class: groovy.lang.Binding
	at groovy.lang.Binding.getVariable(Binding.java:63)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:224)
	at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:238)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:24)
	at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
	at WorkflowScript.run(WorkflowScript:3)
	at ___cps.transform___(Native Method)

I discovered that in order to get the default behaviour, I have to use the syntax "androidLint()", which is not quite as nice as simply "androidLint", which I expected should work.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Sep 9, 2016, 4:37:02 PM9/9/16
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
Change By: Jesse Glick
Component/s: workflow-cps-plugin
Component/s: pipeline

jglick@cloudbees.com (JIRA)

unread,
Sep 9, 2016, 4:37:05 PM9/9/16
to jenkinsc...@googlegroups.com
Jesse Glick resolved as Not A Defect
 

Yeah you need androidLint(). Not specific to symbols: see pwd() for example. Just an aspect of how the Groovy parser decides what it is looking at, I think. Not sure if there is some way to make CpsScript.getProperty ask DSL.invokeMethod to run a “naked” step.

Not a bug unless Snippet Generator fails to suggest a working notation.

Change By: Jesse Glick
Status: Open Resolved
Resolution: Not A Defect
Reply all
Reply to author
Forward
0 new messages