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

Git plugin using local config to update submodules

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Blocker Blocker
    • git-plugin
    • None
    • Jenkins v2.6, Git plugin version 3.0.0, git-client 2.2.1

      In order to get all of the submodules, the git plugin looks in the local configuration file:

       > git config --get-regexp ^submodule # timeout=10
       > git config --get submodule.externals/jzmq.url # timeout=10
       > git submodule update --remote externals/jzmq
       > git config --get submodule.protobuf-java-format.url # timeout=10
       > git submodule update --remote protobuf-java-format
      FATAL: Command "git submodule update --remote protobuf-java-format" returned status code 1:
      stdout: 
      stderr: error: pathspec 'protobuf-java-format' did not match any file(s) known to git.
      

      However, the .git/config file is local per repository, and old entries and sections do not get overriden. Therefore, when a submodule is no longer in use or has moved, the old configuration can cause an error. Anyway, the local configuration is not part of the remote repository, which is the correct clean repo which is the exclusive authority on git configs.

      A possible solution would be to call deninit in order to remove the old configuration.

      git submodule deinit
      

          [JENKINS-38860] Git plugin using local config to update submodules

          Boris Danilovich created issue -
          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]

          Kaveh Vaghefi added a comment - - edited

          I'm running into this too. This is a huge regression from where the plugin was at. It's like this plugin wasn't tested before going live.

          I think this is a git-client issue.

          Kaveh Vaghefi added a comment - - edited I'm running into this too. This is a huge regression from where the plugin was at. It's like this plugin wasn't tested before going live. I think this is a git-client issue.
          Kaveh Vaghefi made changes -
          Priority Original: Major [ 3 ] New: Blocker [ 1 ]
          Mark Waite made changes -
          Link New: This issue is related to JENKINS-37419 [ JENKINS-37419 ]
          Kaveh Vaghefi made changes -
          Environment Original: Jenkins v2.6, Git plugin version 3.0.0 New: Jenkins v2.6, Git plugin version 3.0.0, git-client 2.0.0

          I'm not enough of a git guru to understand exactly what is happening here, but I believe I am being bitten by this issue. Cannot get any builds working

          Does anyone have a workaround?

          Lars Hagström added a comment - I'm not enough of a git guru to understand exactly what is happening here, but I believe I am being bitten by this issue. Cannot get any builds working Does anyone have a workaround?

          Kaveh Vaghefi added a comment -

          The workaround is to downgrade the git-plugin and git-client to the previous revision. I have to ask, why is the submodule update being done like this anyway? What was wrong with 'git submodule update --init'?

          Kaveh Vaghefi added a comment - The workaround is to downgrade the git-plugin and git-client to the previous revision. I have to ask, why is the submodule update being done like this anyway? What was wrong with 'git submodule update --init'?

          Roman Karlstetter added a comment - - edited

          I can confirm this issue. It happened to us after the update of the git-plugin to version 3.0.0. 'git submodule update --init' always worked fine for us.

          This is the error we are getting:

          > C:\Program Files\Git\bin\git.exe submodule update --init --recursive old_path/to/sub
          FATAL: Command "C:\Program Files\Git\bin\git.exe submodule update --init --recursive old_path/to/sub" returned status code 1:
          stdout: 
          stderr: error: pathspec 'old_path/to/sub' did not match any file(s) known to git.
          
          hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe submodule update --init --recursive old_path/to/sub" returned status code 1:
          stdout: 
          stderr: error: pathspec 'old_path/to/sub' did not match any file(s) known to git.
          
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.execute(CliGitAPIImpl.java:1032)
          	at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:96)
          	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1137)
          	at hudson.scm.SCM.checkout(SCM.java:495)
          	at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
          	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
          	at hudson.model.Run.execute(Run.java:1728)
          	at hudson.matrix.MatrixBuild.run(MatrixBuild.java:313)
          	at hudson.model.ResourceController.execute(ResourceController.java:98)
          	at hudson.model.Executor.run(Executor.java:404)
          

          One thing to note: it uses old_path/to/sub instead of the actual new path. In .gitmodules, "old_path/to/sub" is just still the name of the submodule, so it tries to use the name instead of the actually configured submodule path.

          Roman Karlstetter added a comment - - edited I can confirm this issue. It happened to us after the update of the git-plugin to version 3.0.0. 'git submodule update --init' always worked fine for us. This is the error we are getting: > C:\Program Files\Git\bin\git.exe submodule update --init --recursive old_path/to/sub FATAL: Command "C:\Program Files\Git\bin\git.exe submodule update --init --recursive old_path/to/sub" returned status code 1: stdout: stderr: error: pathspec 'old_path/to/sub' did not match any file(s) known to git. hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe submodule update --init --recursive old_path/to/sub" returned status code 1: stdout: stderr: error: pathspec 'old_path/to/sub' did not match any file(s) known to git. at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.execute(CliGitAPIImpl.java:1032) at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:96) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1137) at hudson.scm.SCM.checkout(SCM.java:495) at hudson.model.AbstractProject.checkout(AbstractProject.java:1278) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) at hudson.model.Run.execute(Run.java:1728) at hudson.matrix.MatrixBuild.run(MatrixBuild.java:313) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404) One thing to note: it uses old_path/to/sub instead of the actual new path. In .gitmodules, "old_path/to/sub" is just still the name of the submodule, so it tries to use the name instead of the actually configured submodule path.

          Hi,

          Please can i know is there any other work around to fix this issue

          "stderr: error: pathspec 'ProjectA/testrepo' did not match any file(s) known to git."

          This is really blocking our all builds.

          As of now we are wiping out our workspace to ignore this error every time.

          Thanks.

          Senthilkumar Palanisamy added a comment - Hi, Please can i know is there any other work around to fix this issue "stderr: error: pathspec 'ProjectA/testrepo' did not match any file(s) known to git." This is really blocking our all builds. As of now we are wiping out our workspace to ignore this error every time. Thanks.

            Unassigned Unassigned
            bdanilovich Boris Danilovich
            Votes:
            16 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated:
              Resolved: