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

Workflow shared library improvements

    XMLWordPrintable

Details

    Description

      In the context of pipeline as code, as an user, I have a lot of Jenkinsfile everywhere in my repositories and branches.

      • The developers that deal with them as not necessarily familar with Jenkins, so those files should be high-level and understandable to those who don't know Jenkins.
      • As an admin of Jenkins, I want to keep those files DRY by defining higher-level custom idioms
      • As an intermediate user of Jenkins, I want to reuse building blocks of workflow that other knowledgeable people in the Jenkins community has developed.

      Workflow plugin has one mechanism that touches (some of) this use case today, but it still need more improvements. Also, conversations with other Jenkins devs indicate that many want additional mechanisms to refer to reusable modules, and some has already developed additional plugins to do that.

      As the Jenkins community, we need to build a small set of mechanisms to achieve 80% of these goals, while enabling other people to write plugins that support more unique use cases.

      This ticket is a part of the 2.0 planning ticket to drive conversations about this and link to relevant activities.

      Attachments

        Issue Links

          Activity

            Same problem here when loading the library from Jenkinsfile I can see:

            Loading library github.com/moltin/jenkins-pipeline-library@master
            Creating git repository in /var/jenkins_home/caches/git-10e1b910805192749e5be85c3935e6d6
             > git init /var/jenkins_home/caches/git-10e1b910805192749e5be85c3935e6d6 # timeout=10
            Setting origin to https://github.com/moltin/jenkins-pipeline-library.git
            

            But when trying to use the Global Configuration the following it's thrown:

            Loading library github.com/moltin/jenkins-pipeline-library@branches/master
            java.lang.NullPointerException
            	at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrieve(SCMSourceRetriever.java:74)
            	at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:150)
            	at org.jenkinsci.plugins.workflow.libs.LibraryAdder.add(LibraryAdder.java:131)
            

            So something different it's happening when loading the library from the Jenkinsfile vs Global configuration

            zot24 Israel Sotomayor added a comment - Same problem here when loading the library from Jenkinsfile I can see: Loading library github.com/moltin/jenkins-pipeline-library@master Creating git repository in / var /jenkins_home/caches/git-10e1b910805192749e5be85c3935e6d6 > git init / var /jenkins_home/caches/git-10e1b910805192749e5be85c3935e6d6 # timeout=10 Setting origin to https: //github.com/moltin/jenkins-pipeline-library.git But when trying to use the Global Configuration the following it's thrown: Loading library github.com/moltin/jenkins-pipeline-library@branches/master java.lang.NullPointerException at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrieve(SCMSourceRetriever.java:74) at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:150) at org.jenkinsci.plugins.workflow.libs.LibraryAdder.add(LibraryAdder.java:131) So something different it's happening when loading the library from the Jenkinsfile vs Global configuration
            mkobit Mike Kobit added a comment -

            Filed https://issues.jenkins-ci.org/browse/JENKINS-38424 for the issue I was seeing with not being able to configure global pipeline libraries.

            mkobit Mike Kobit added a comment - Filed https://issues.jenkins-ci.org/browse/JENKINS-38424 for the issue I was seeing with not being able to configure global pipeline libraries.

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java
            src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java
            src/test/java/jenkins/plugins/git/GitSampleRepoRule.java
            http://jenkins-ci.org/commit/git-plugin/2b201d825c101b7ff6be71dad11d2d7d59ce1f81
            Log:
            JENKINS-31155 Implement new retrieve(String, TaskListener) overload.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java src/test/java/jenkins/plugins/git/GitSampleRepoRule.java http://jenkins-ci.org/commit/git-plugin/2b201d825c101b7ff6be71dad11d2d7d59ce1f81 Log: JENKINS-31155 Implement new retrieve(String, TaskListener) overload.

            Code changed in jenkins
            User: Mark Waite
            Path:
            pom.xml
            src/main/java/hudson/plugins/git/UserRemoteConfig.java
            src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java
            src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java
            src/test/java/jenkins/plugins/git/GitSampleRepoRule.java
            http://jenkins-ci.org/commit/git-plugin/0c6d93913a70007c8061a5a37438549d72bede9f
            Log:
            Merge pull request #433 from jglick/retrieve-revision-JENKINS-31155

            JENKINS-31155 Ability to retrieve a single revision

            Compare: https://github.com/jenkinsci/git-plugin/compare/2025127d7e82...0c6d93913a70

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: pom.xml src/main/java/hudson/plugins/git/UserRemoteConfig.java src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java src/test/java/jenkins/plugins/git/GitSampleRepoRule.java http://jenkins-ci.org/commit/git-plugin/0c6d93913a70007c8061a5a37438549d72bede9f Log: Merge pull request #433 from jglick/retrieve-revision- JENKINS-31155 JENKINS-31155 Ability to retrieve a single revision Compare: https://github.com/jenkinsci/git-plugin/compare/2025127d7e82...0c6d93913a70
            markewaite Mark Waite added a comment -

            Released in git plugin 3.0.1 18 Nov 2016

            markewaite Mark Waite added a comment - Released in git plugin 3.0.1 18 Nov 2016

            People

              jglick Jesse Glick
              kohsuke Kohsuke Kawaguchi
              Votes:
              17 Vote for this issue
              Watchers:
              40 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: