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

User-defined functions in git-global-lib

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: pipeline
    • Labels:
      None
    • Similar Issues:

      Description

      Provide an area in the Git repository to store Groovy files, where function calls in DSL scripts like xyz(a, b, c) automatically resolve into loading xyz.groovy and calling its run(a, b, c) method.

      This will enable the team that designs workflow libraries to really beautify the syntax that end users will see.

        Attachments

          Issue Links

            Activity

            jglick Jesse Glick created issue -
            Hide
            jglick Jesse Glick added a comment -

            If implemented, parallel could potentially be defined as something like

            void run(branches) {
                forkBox {
                    for (e : branches.entrySet()) {
                        fork(e.key) {e.getValue()()}
                    }
                }
            }
            
            Show
            jglick Jesse Glick added a comment - If implemented, parallel could potentially be defined as something like void run(branches) { forkBox { for (e : branches.entrySet()) { fork(e.key) {e.getValue()()} } } }
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Link This issue is related to JENKINS-26052 [ JENKINS-26052 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 131 (Web Link)" [ 12911 ]
            Hide
            jglick Jesse Glick added a comment -

            PR 131 addresses a similar, though not identical, RFE.

            Show
            jglick Jesse Glick added a comment - PR 131 addresses a similar, though not identical, RFE.
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            CHANGES.md
            http://jenkins-ci.org/commit/workflow-plugin/67acb26ea325bffb459aac8d81a01e0bcf8c6510
            Log:
            JENKINS-26135 Noting.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md http://jenkins-ci.org/commit/workflow-plugin/67acb26ea325bffb459aac8d81a01e0bcf8c6510 Log: JENKINS-26135 Noting.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Kohsuke Kawaguchi
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/cps/global/WorkflowLibRepositoryTest.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScript.java
            http://jenkins-ci.org/commit/workflow-plugin/9cdadd25a63ea5f586f275741cd077f9ab2e7682
            Log:
            JENKINS-26135

            Global variable should be usable as a function, just like in Groovy
            Closure property can be called like a function.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/cps/global/WorkflowLibRepositoryTest.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScript.java http://jenkins-ci.org/commit/workflow-plugin/9cdadd25a63ea5f586f275741cd077f9ab2e7682 Log: JENKINS-26135 Global variable should be usable as a function, just like in Groovy Closure property can be called like a function.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            CHANGES.md
            aggregator/src/test/groovy/org/jenkinsci/plugins/workflow/cps/steps/LoadStepTest.groovy
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/CpsFlowExecutionTest.java
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/cps/global/WorkflowLibRepositoryTest.java
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/cps/steps/LoadStepTest.java
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java
            cps-global-lib/README.md
            cps-global-lib/src/main/java/org/jenkinsci/plugins/workflow/cps/global/UserDefinedGlobalVariable.java
            cps-global-lib/src/main/java/org/jenkinsci/plugins/workflow/cps/global/UserDefinedGlobalVariableList.java
            cps-global-lib/src/main/java/org/jenkinsci/plugins/workflow/cps/global/WorkflowLibRepository.java
            cps-global-lib/src/main/resources/org/jenkinsci/plugins/workflow/cps/global/UserDefinedGlobalVariable/help.jelly
            cps-global-lib/src/test/java/org/jenkinsci/plugins/workflow/cps/global/UserDefinedGlobalVariableListTest.java
            cps/pom.xml
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsClosure2.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsGroovyShell.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScript.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsWhitelist.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/GlobalVariable.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/GlobalVariableSet.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/Snippetizer.java
            pom.xml
            http://jenkins-ci.org/commit/workflow-plugin/28c9600d1c623779b62e2e46e187671671501a21
            Log:
            Merge pull request #131 from jenkinsci/user-defined-global-libs

            JENKINS-26135 Allow CPS global lib scripts to define global variables

            Compare: https://github.com/jenkinsci/workflow-plugin/compare/4423736b18e5...28c9600d1c62

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md aggregator/src/test/groovy/org/jenkinsci/plugins/workflow/cps/steps/LoadStepTest.groovy aggregator/src/test/java/org/jenkinsci/plugins/workflow/CpsFlowExecutionTest.java aggregator/src/test/java/org/jenkinsci/plugins/workflow/cps/global/WorkflowLibRepositoryTest.java aggregator/src/test/java/org/jenkinsci/plugins/workflow/cps/steps/LoadStepTest.java aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java cps-global-lib/README.md cps-global-lib/src/main/java/org/jenkinsci/plugins/workflow/cps/global/UserDefinedGlobalVariable.java cps-global-lib/src/main/java/org/jenkinsci/plugins/workflow/cps/global/UserDefinedGlobalVariableList.java cps-global-lib/src/main/java/org/jenkinsci/plugins/workflow/cps/global/WorkflowLibRepository.java cps-global-lib/src/main/resources/org/jenkinsci/plugins/workflow/cps/global/UserDefinedGlobalVariable/help.jelly cps-global-lib/src/test/java/org/jenkinsci/plugins/workflow/cps/global/UserDefinedGlobalVariableListTest.java cps/pom.xml cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsClosure2.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsGroovyShell.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScript.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsWhitelist.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/GlobalVariable.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/GlobalVariableSet.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/Snippetizer.java pom.xml http://jenkins-ci.org/commit/workflow-plugin/28c9600d1c623779b62e2e46e187671671501a21 Log: Merge pull request #131 from jenkinsci/user-defined-global-libs JENKINS-26135 Allow CPS global lib scripts to define global variables Compare: https://github.com/jenkinsci/workflow-plugin/compare/4423736b18e5...28c9600d1c62
            Hide
            jglick Jesse Glick added a comment -

            Merged.

            Show
            jglick Jesse Glick added a comment - Merged.
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            jglick Jesse Glick made changes -
            Link This issue depends on JENKINS-30390 [ JENKINS-30390 ]
            jglick Jesse Glick made changes -
            Link This issue depends on JENKINS-30414 [ JENKINS-30414 ]
            jglick Jesse Glick made changes -
            Link This issue depends on JENKINS-30390 [ JENKINS-30390 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Kohsuke Kawaguchi
            Path:
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScript.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/fee680c0736ee5a5610ac23158c45c0e273ea951
            Log:
            JENKINS-26135

            Global variable should be usable as a function, just like in Groovy
            Closure property can be called like a function.

            Originally-Committed-As: 9cdadd25a63ea5f586f275741cd077f9ab2e7682

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScript.java http://jenkins-ci.org/commit/workflow-cps-plugin/fee680c0736ee5a5610ac23158c45c0e273ea951 Log: JENKINS-26135 Global variable should be usable as a function, just like in Groovy Closure property can be called like a function. Originally-Committed-As: 9cdadd25a63ea5f586f275741cd077f9ab2e7682
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 160125 ] JNJira + In-Review [ 196331 ]
            abayer Andrew Bayer made changes -
            Component/s pipeline-general [ 21692 ]
            abayer Andrew Bayer made changes -
            Component/s workflow-plugin [ 18820 ]

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: