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

Changing remote URL doesn't update submodules

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • git-plugin
    • None

    Description

      If you create a project that has a relative submodule path. Say this is hosted in your personal github space:

      https://github.com/username/mainproject
      https://github.com/username/subproject

      The subproject it part of the mainproject with an entry link this in the .gitmodules:

      [submodule "subproject"]
      path = subproject
      url = ../subproject.git

      Using relative URLs has many benefits, a primary one being the checkout works over any protocol.

      If you setup a jenkins job to build mainproject everything works fine, if the project is then move to a different github account (say to your employers organisation):

      https://github.com/organisation/mainproject
      https://github.com/organisation/subproject

      Changing the URL the jenkins jobs works for pulling in changes from mainproject, but when submodule updates are attempted the old url still gets used. This seems to be because the origin remote in the mainproject repository doesn't get updated with the new URL and so all the relative URLs remain relative to that project.

      Attachments

        Issue Links

          Activity

            buckett Matthew Buckett created issue -

            Logging into the build server over ssh and setting the origin remote to the new URL works.
            Cleaning out the should work (I didn't want todo this as our checkout is about 600MB of source and takes a while to get again).

            buckett Matthew Buckett added a comment - Logging into the build server over ssh and setting the origin remote to the new URL works. Cleaning out the should work (I didn't want todo this as our checkout is about 600MB of source and takes a while to get again).
            avalokita Kelly Johnson added a comment -

            Solution in JENKINS-8503 would fix this as well.

            avalokita Kelly Johnson added a comment - Solution in JENKINS-8503 would fix this as well.
            avalokita Kelly Johnson made changes -
            Field Original Value New Value
            Link This issue is related to JENKINS-8503 [ JENKINS-8503 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 146133 ] JNJira + In-Review [ 176540 ]

            Code changed in jenkins
            User: Mark Waite
            Path:
            src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java
            http://jenkins-ci.org/commit/git-client-plugin/eec1a16bc7ddff1ffd022f5c9e5f631f1a63f329
            Log:
            Add two detailed submodule tests

            Tests describe the implementation as it currently exists, in hopes
            of detecting future regressions with test execution. The tests show
            inconsistencies between the CliGitAPIImpl and JGitAPIImpl classes,
            and inconsistencies between command line git and JGit behavior.

            Command line git clean as implemented in CliGitAPIImpl does not remove
            untracked submodules or files contained in untracked submodule dirs.
            JGit clean as implemented in JGitAPIImpl removes untracked submodules.
            This test captures that surprising difference between the implementations.

            CliGitAPIImpl supports renamed submodules. JGitAPIImpl does not support
            renamed submodules. One of these tests captures that difference.

            See bug reports such as:
            JENKINS-22510 - Clean After Checkout Results in Failed to Checkout Revision
            JENKINS-8053 - Git submodules are cloned too early and not removed once the revToBuild has been checked out
            JENKINS-14083 - Build can't recover from broken submodule path
            JENKINS-15399 - Changing remote URL doesn't update submodules

            Compare: https://github.com/jenkinsci/git-client-plugin/compare/cdcbfd56f49f...eec1a16bc7dd

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java http://jenkins-ci.org/commit/git-client-plugin/eec1a16bc7ddff1ffd022f5c9e5f631f1a63f329 Log: Add two detailed submodule tests Tests describe the implementation as it currently exists, in hopes of detecting future regressions with test execution. The tests show inconsistencies between the CliGitAPIImpl and JGitAPIImpl classes, and inconsistencies between command line git and JGit behavior. Command line git clean as implemented in CliGitAPIImpl does not remove untracked submodules or files contained in untracked submodule dirs. JGit clean as implemented in JGitAPIImpl removes untracked submodules. This test captures that surprising difference between the implementations. CliGitAPIImpl supports renamed submodules. JGitAPIImpl does not support renamed submodules. One of these tests captures that difference. See bug reports such as: JENKINS-22510 - Clean After Checkout Results in Failed to Checkout Revision JENKINS-8053 - Git submodules are cloned too early and not removed once the revToBuild has been checked out JENKINS-14083 - Build can't recover from broken submodule path JENKINS-15399 - Changing remote URL doesn't update submodules Compare: https://github.com/jenkinsci/git-client-plugin/compare/cdcbfd56f49f...eec1a16bc7dd
            ndeloof Nicolas De Loof made changes -
            Assignee Nicolas De Loof [ ndeloof ]
            markewaite Mark Waite made changes -
            Link This issue is related to JENKINS-63049 [ JENKINS-63049 ]

            People

              Unassigned Unassigned
              buckett Matthew Buckett
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: