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

Git plugin checking out non-existent submodule from different branch

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.13, Git Plugin 2.5.3
    • Similar Issues:

      Description

      I'm seeing an issue when doing a recursive checkout of submodules in our repository where the Git plugin will attempt to check out a non-existent submodule that was recently added in a different branch but has not yet been merged. This is causing all subsequent builds to fail that have not yet had a merge to include this submodule. Here is an excerpt from our build logs:

      I've blanked out sensitive path information with ***, just an FYI:
      11:19:09 Checking out Revision *** (origin/master)
      11:19:09 > git config core.sparsecheckout # timeout=10
      11:19:09 > git checkout -f ***
      11:19:10 > git rev-list *** # timeout=10

      11:19:10 > git remote # timeout=10
      11:19:10 > git submodule init # timeout=10

      11:19:12 > git submodule sync # timeout=10

      11:19:18 > git config --get remote.origin.url # timeout=10

      11:19:18 > git config --get-regexp ^submodule # timeout=10
      11:19:19 > git config --get submodule.BuildFiles/***.url # timeout=10
      11:19:19 > git submodule update --init --recursive BuildFiles/***

      11:19:23 > git config --get submodule.***.url # timeout=10
      11:19:23 > git submodule update --init --recursive ***

      11:19:27 > git config --get submodule.test/***.url # timeout=10

      11:19:27 > git submodule update --init --recursive test/***

      11:19:29 FATAL: Command "git submodule update --init --recursive test/***" returned status code 1:
      11:19:29 stdout:
      11:19:29 stderr: error: pathspec 'test/***' did not match any file(s) known to git.
      11:19:29
      11:19:29 hudson.plugins.git.GitException: Command "git submodule update --init --recursive test/**" returned status code 1:
      11:19:29 stdout:
      11:19:29 stderr: error: pathspec 'test/***' did not match any file(s) known to git.

      I've traced the issue to the command "git config --get-regexp ^submodule". This is picking up the offending submodule and including it in the recursive update, despite it not being attached to the commit in question. This seems to be a problem with the Git program itself but when I do a recursive update from the command line, I don't see this issue. It seems to be attached to the process through which the Jenkins Git plugin identifies the submodules present. Would it be possible to add a check so the update does not include submodules that don't exist in the commit being targeted? I assume this will be resolved once the submodule gets merged into master but it's very inconvenient for the time being as all our follow-up builds are now failing.

      I'm not sure if this is relevant but the current branch setup has it pointed to a detached head on a specific commit. This could be impacting how the submodules are being picked up and returned.

      Thanks!

        Attachments

          Issue Links

            Activity

            Hide
            samdeane Sam Deane added a comment - - edited

            Will do. Am I likely to encounter any other problems by rolling back to an older version? Are there any dependencies between the git plugin and things like the GitHub one? That has been my concern about rolling back just one plugin. If that concern is misplaced, then great

            Show
            samdeane Sam Deane added a comment - - edited Will do. Am I likely to encounter any other problems by rolling back to an older version? Are there any dependencies between the git plugin and things like the GitHub one? That has been my concern about rolling back just one plugin. If that concern is misplaced, then great
            Hide
            markewaite Mark Waite added a comment -

            It depends on the plugins you use. Most plugins intentionally depend on older versions of their dependencies so that they don't require user upgrades to a dependent plugin.

            The git plugin 3.0 release was also the release which forces users to at least Jenkins 1.625. Most plugins are not dependent on git plugin 3.0 as far as I know. The Jenkins wiki shows the dependencies for the most release release of each plugin, if that helps.

            Show
            markewaite Mark Waite added a comment - It depends on the plugins you use. Most plugins intentionally depend on older versions of their dependencies so that they don't require user upgrades to a dependent plugin. The git plugin 3.0 release was also the release which forces users to at least Jenkins 1.625. Most plugins are not dependent on git plugin 3.0 as far as I know. The Jenkins wiki shows the dependencies for the most release release of each plugin, if that helps.
            Hide
            courtarro Ethan Trewhitt added a comment -

            Submitted PR 230, which aims to fix this one.

            Show
            courtarro Ethan Trewhitt added a comment - Submitted PR 230 , which aims to fix this one.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Ethan Trewhitt
            Path:
            src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
            http://jenkins-ci.org/commit/git-client-plugin/28db63d60dca2c20c714036c26b9208bd2a6bbbb
            Log:
            Reference the .gitmodules file to get a list of current submodules, rather than the .git/config file, which may have old submodules from other branches. JENKINS-37419

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ethan Trewhitt Path: src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java http://jenkins-ci.org/commit/git-client-plugin/28db63d60dca2c20c714036c26b9208bd2a6bbbb Log: Reference the .gitmodules file to get a list of current submodules, rather than the .git/config file, which may have old submodules from other branches. JENKINS-37419
            Hide
            markewaite Mark Waite added a comment -

            Fixed in git client plugin 2.2.0, released 2 Jan 2017

            Show
            markewaite Mark Waite added a comment - Fixed in git client plugin 2.2.0, released 2 Jan 2017

              People

              • Assignee:
                Unassigned
                Reporter:
                nlykins Nick Lykins
              • Votes:
                9 Vote for this issue
                Watchers:
                14 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: