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

git plugin 3.6.3 lost support for tagged pipeline shared libraries

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • git-plugin
    • None
    • Jenkins 2.73.3-rc
      Git plugin 3.6.3
      Git client plugin 2.6.0

      A pipeline global shared library configured to checkout at a specific tag was able to checkout with git plugin 3.3.2. With git plugin 3.6.3, that checkout fails with the message:

      > git fetch --no-tags --progress https://github.com/cloudbees/elroy-libs.git +refs/heads/v1.1:refs/remotes/origin/v1.1
      ERROR: Error fetching remote repo 'origin'
      hudson.plugins.git.GitException: Failed to fetch from https://github.com/cloudbees/elroy-libs.git
      	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:825)
      	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1092)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1123)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
      	at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.doRetrieve(SCMSourceRetriever.java:112)
      	at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrieve(SCMSourceRetriever.java:84)
      	at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:153)
      	at org.jenkinsci.plugins.workflow.libs.LibraryAdder.add(LibraryAdder.java:134)
      	at org.jenkinsci.plugins.workflow.libs.LibraryDecorator$1.call(LibraryDecorator.java:125)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
      	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
      	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:129)
      	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:123)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:517)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:480)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:269)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:421)
      Caused by: hudson.plugins.git.GitException: Command "git fetch --no-tags --progress https://github.com/cloudbees/elroy-libs.git +refs/heads/v1.1:refs/remotes/origin/v1.1" returned status code 128:
      stdout: 
      stderr: fatal: Couldn't find remote ref refs/heads/v1.1
      
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1970)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1689)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:380)
      	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:823)
      	... 23 more
      ERROR: Error fetching remote repo 'origin'
      

      It appears that the refspec being requested in the git fetch is referring to the tag name v1.1 as though it were a branch name. It is requesting a refspec +refs/heads/v1.1:refs/remotes/origin/v1.1 when it should either refer to a wildcard in the refspec, or to a valid branch name in the refspec.

      To see the checkout work successfully with the earlier version:

      1. Clone my private docker repo
        $ git lfs clone git@github.com:MarkEWaite/docker-private-lfs.git jenkins47824 && cd jenkins47824
      2. Checkout the working branch configuration
        $ git lfs fetch origin origin/cjt-with-plugins-add-credentials
        $ git checkout -b cjt-with-plugins-add-credentials -t origin/cjt-with-plugins-add-credentials
      3. Build the working branch configuration with docker
        $ docker build -t jenkins47824:working .
      4. Run the working branch configuration with docker
        $ docker run -i --rm --publish 9090:8080 -t jenkins47824:working
      5. Connect to port 9090, sign up (to login), open the "Bugs - Individual" folder and the "support-analytics" multi-branch Pipeline
      6. Index the support-analytics multibranch pipeline, and confirm that the two jobs run, and are able to clone the shared library. The jobs will fail, but they will be able to clone the shared library

      Perform the same steps, but with cjt-with-plugins-add-credentials-no-cap as the branch. That job will fail with the stack trace listed above.

      1. Clone my private docker repo
        $ git lfs clone git@github.com:MarkEWaite/docker-private-lfs.git jenkins47824bad && cd jenkins47824bad
      2. Checkout the working branch configuration
        $ git lfs fetch origin origin/cjt-with-plugins-add-credentials-no-cap
        $ git checkout -b cjt-with-plugins-add-credentials-no-cap -t origin/cjt-with-plugins-add-credentials-no-cap
      3. Build the working branch configuration with docker
        $ docker build -t jenkins47824:bad .
      4. Run the working branch configuration with docker
        $ docker run -i --rm --publish 9095:8080 -t jenkins47824:bad
      5. Connect to port 9095, sign up (to login), open the "Bugs - Individual" folder and the "support-analytics" multi-branch Pipeline
      6. Index the support-analytics multibranch pipeline, and confirm that the two jobs run, and are not able to clone the shared library. The jobs will fail with the message listed above

            stephenc Stephen Connolly
            markewaite Mark Waite
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: