-
Improvement
-
Resolution: Won't Do
-
Minor
When you specify the branch name as a '.' (period) in .gitModules you should be able to use the --remote option to update submodules to the head the branch that matches the parent branch.
When doing this in Jenkins we get the following error:
hudson.plugins.git.GitException: Command "/usr/bin/git submodule update --init --recursive --remote curavi-common" returned status code 1: stdout: stderr: Cloning into 'curavi-common'... fatal: Needed a single revision Unable to find current origin/. revision in submodule path 'curavi-common' at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.execute(CliGitAPIImpl.java:1202) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146) at hudson.remoting.UserRequest.perform(UserRequest.java:212) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:369) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused: java.io.IOException: Could not perform submodule update at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:113) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1270) at hudson.scm.SCM.checkout(SCM.java:504) at hudson.model.AbstractProject.checkout(AbstractProject.java:1208) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499) at hudson.model.Run.execute(Run.java:1818) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) Finished: FAILURE
Example .gitModule:
[submodule "curavi-common"]
path = curavi-common
url = git@bitbucket.org:curavihealth/curavi-common.git
branch = .
I've check the 'Update tracking submodules to tip of branch' option under "Advanced sub-module behaviors.
I'm expecting the job to clone my parent project and then get the HEAD of submodule with the same branch name. Locally this works by running 'git submodule update --remote' However this fails with the stack trace above.
Thanks!