Jenkins Git change submodule path
Is there a way to change the submodule path to pull from a different repository during build time?
One Solution collect form web for “Jenkins Git change submodule path”
Submodule URLs are set in the
.gitmodules file in your repo, so you just need to modify the URL within that file.
git-config accepts a
-f argument indicating the config file, which you can use to specify the
.gitmodules file instead of the normal
~/.gitconfig files which are normally used. Using this option, you could modify the submodule URL with the following:
git config -f .gitmodules submodule.<submodule name>.url <new URL>
Or, you could manually modify the submodule’s URL in the
.gitmodules file to the changed path. A shell script phase prior to your build phase in Jenkins could accomplish modifying that file, and if necessary you could
git checkout -- . afterward to restore the original URL.
Either way, you’ll want to run
git submodule sync afterward to reflect the change in the containing repo.