Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-37736

$class-less syntax doesn't work as expected for build steps with no-args ctor

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None

      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.

            jglick Jesse Glick
            orrc Christopher Orr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: