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

Promote delegates of metasteps to top-level functions, deprecate $class

    Details

    • Similar Issues:

      Description

      Currently you must write e.g.

      step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/*.xml'])
      

      which is awkward. Also in Snippet Generator you need to look under General Build Step for what to a user is logically a distinct step.

      Metasteps (step, wrap, checkout) should have an API by which they can declare that their delegate (scm in the last case) ought to be treated as a top-level step as far as DSL and Snippetizer are concerned, via some kind of syntactic sugar. In the absence of any Jenkins core API which would allow a Descriptor to specify a short name (yaml-project tries to define one of its own), this would have to be constructed somehow from the $class, perhaps simply:

      JUnitResultArchiver testResults: 'target/surefire-reports/*.xml'
      

      or with just one mandatory parameter even

      JUnitResultArchiver 'target/surefire-reports/*.xml'
      

      The follow-up question is what to do with nested Describable objects used in the configuration. So

      GitSCM ..., extensions: [[$class: 'PruneStaleBranch']]
      

      still looks unnatural. The Groovy builder idiom might suggest

      GitSCM ..., extensions: [PruneStaleBranch {}]
      

      though closure handling in JENKINS-26135 would need to be addressed first. Requires study to make a PoC.

        Attachments

          Issue Links

            Activity

            jglick Jesse Glick created issue -
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Link This issue is related to JENKINS-30088 [ JENKINS-30088 ]
            jglick Jesse Glick made changes -
            Link This issue depends on JENKINS-30222 [ JENKINS-30222 ]
            jglick Jesse Glick made changes -
            Summary Promote delegates of metasteps to top-level functions Promote delegates of metasteps to top-level functions, deprecate $class
            Assignee Jesse Glick [ jglick ] Kohsuke Kawaguchi [ kohsuke ]
            jglick Jesse Glick made changes -
            Link This issue is blocking JENKINS-30519 [ JENKINS-30519 ]
            jglick Jesse Glick made changes -
            Link This issue is blocking JENKINS-31247 [ JENKINS-31247 ]
            jglick Jesse Glick made changes -
            Link This issue depends on JENKINS-30222 [ JENKINS-30222 ]
            jglick Jesse Glick made changes -
            Assignee Kohsuke Kawaguchi [ kohsuke ]
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-26126 [ JENKINS-26126 ]
            jglick Jesse Glick made changes -
            Epic Link JENKINS-35394 [ 171187 ]
            jglick Jesse Glick made changes -
            Assignee Kohsuke Kawaguchi [ kohsuke ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            kohsuke Kohsuke Kawaguchi made changes -
            Remote Link This issue links to "Change in the structs-plugin (Web Link)" [ 14558 ]
            kohsuke Kohsuke Kawaguchi made changes -
            Remote Link This issue links to "Change for pipeline-step-api (Web Link)" [ 14559 ]
            kohsuke Kohsuke Kawaguchi made changes -
            Remote Link This issue links to "Change in workflow-basic-steps-plugin (Web Link)" [ 14560 ]
            kohsuke Kohsuke Kawaguchi made changes -
            Remote Link This issue links to "Change in pipeline cps plugin (Web Link)" [ 14561 ]
            kohsuke Kohsuke Kawaguchi made changes -
            Remote Link This issue links to "Honorary mention of JUnit PR (Web Link)" [ 14565 ]
            jglick Jesse Glick made changes -
            Link This issue depends on JENKINS-31582 [ JENKINS-31582 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 165000 ] JNJira + In-Review [ 185626 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "core PR 2484 (Web Link)" [ 14665 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-29711 [ JENKINS-29711 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-multibranch PR 22 (Web Link)" [ 14668 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-cps PR 35 (Web Link)" [ 14673 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "pipeline-plugin PR 401 (Web Link)" [ 14674 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "jenkins.io PR 324 (Web Link)" [ 14675 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "parallel-test-executor-plugin PR 19 (Web Link)" [ 14680 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-basic-steps PR 15 (Web Link)" [ 14681 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-aggregator PR 8 (Web Link)" [ 14689 ]
            jglick Jesse Glick made changes -
            Link This issue is blocked by JENKINS-37215 [ JENKINS-37215 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "junit PR 53 (Web Link)" [ 14701 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "acceptance-test-harness PR 167 (Web Link)" [ 14702 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-job PR 15 (Web Link)" [ 14703 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-cps PR 37 (Web Link)" [ 14704 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-cps PR 38 (Web Link)" [ 14705 ]
            jglick Jesse Glick made changes -
            Link This issue is blocking JENKINS-37227 [ JENKINS-37227 ]
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            jglick Jesse Glick made changes -
            Status In Review [ 10005 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            abayer Andrew Bayer made changes -
            Component/s pipeline-general [ 21692 ]
            abayer Andrew Bayer made changes -
            Component/s workflow-plugin [ 18820 ]
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-35506 [ JENKINS-35506 ]
            jglick Jesse Glick made changes -
            Link This issue is blocked by JENKINS-38037 [ JENKINS-38037 ]
            jglick Jesse Glick made changes -
            Link This issue depends on JENKINS-45109 [ JENKINS-45109 ]

              People

              • Assignee:
                kohsuke Kohsuke Kawaguchi
                Reporter:
                jglick Jesse Glick
              • Votes:
                7 Vote for this issue
                Watchers:
                20 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: