-
Bug
-
Resolution: Unresolved
-
Minor
-
Windows 10 x64
Jenkins 1.635
I'm trying to clone a git repository that is hosted on a Atlassian Stash instance.
The special case about the repository is that it has several submodules in it.
Here is what I did to get to the error:
1) I installed the latest git-plugin (2.4.0) / git-client-plugin (1.19.0) in Jenkins
2) setup a ssh rsa key in Stash
3) configured a Jenkins job to clone the repository from the Stash remote host (via ssh://)
4) configured the ssh key & credentials in the Jenkins job git-plugin settings
now when I run the build, Jenkins sucessfully clones the top-level git repository, but fails when trying to update the submodules (the error looks like Jenkins is trying to read username & password from a CLI, but only for the submodules)
Gestartet durch Benutzer anonymous Baue in Arbeitsbereich C:\Program Files (x86)\Jenkins\jobs\test node\workspace No JDK named 'null' found No JDK named 'null' found > git.exe rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git.exe config remote.origin.url ssh://git@jenkinshost:7999/ipp/ipp-project.git # timeout=10 Fetching upstream changes from ssh://git@jenkinshost:7999/ipp/ipp-project.git > git.exe --version # timeout=10 using GIT_SSH to set credentials > git.exe -c core.askpass=true fetch --tags --progress ssh://git@jenkinshost:7999/ipp/ipp-project.git +refs/heads/*:refs/remotes/origin/* > git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10 > git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10 Checking out Revision a27c48024088c36e6eff3420c699ea1d1977e5cd (refs/remotes/origin/master) No JDK named 'null' found > git.exe config core.sparsecheckout # timeout=10 > git.exe checkout -f a27c48024088c36e6eff3420c699ea1d1977e5cd > git.exe rev-list a27c48024088c36e6eff3420c699ea1d1977e5cd # timeout=10 > git.exe remote # timeout=10 > git.exe submodule init # timeout=10 > git.exe submodule sync # timeout=10 > git.exe config --get remote.origin.url # timeout=10 > git.exe submodule update FATAL: Command "git.exe submodule update" returned status code 1: stdout: stderr: Cloning into 'apps/ipp-app'... error: cannot spawn echo : No such file or directory bash: /dev/tty: No such device or address error: failed to execute prompt script (exit code 1) fatal: could not read Username for 'http://jenkinshost:7990': No error Clone of 'http://jenkinshost:7990/scm/ipp/ipp-app.git' into submodule path 'apps/ipp-app' failed hudson.plugins.git.GitException: Command "git.exe submodule update" returned status code 1: stdout: stderr: Cloning into 'apps/ipp-app'... error: cannot spawn echo : No such file or directory bash: /dev/tty: No such device or address error: failed to execute prompt script (exit code 1) fatal: could not read Username for 'http://jenkinshost:7990': No error Clone of 'http://jenkinshost:7990/scm/ipp/ipp-app.git' into submodule path 'apps/ipp-app' failed at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:62) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$6.execute(CliGitAPIImpl.java:904) at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:83) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1074) at hudson.scm.SCM.checkout(SCM.java:485) at hudson.model.AbstractProject.checkout(AbstractProject.java:1275) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532) at hudson.model.Run.execute(Run.java:1741) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Finished: FAILURE
Right after I created the issue I found out what the problem actually was and it is not related to Jenkins.
I had used absolute paths using the http:// protocol in the top-level repository's .gitmodules file.
This of course caused trouble when Jenkins tried to clone the submodules, since it had to authenticate with something other than the ssh key that I provided.
(a good explaination how to fix this in the .gitmodules file can be found at this website ... http://blog.tremily.us/posts/Relative_submodules/)
What still could be discussed in this is issue is the error reporting by Jenkins / the GIT plugins in such a case. I guess it would be possible to put an additional warning or error message in the build log if a GIT repository uses submodules inside a repository that have the same host URL but use different protocols (http, https, ssh).
A warning that such a scenario could be a potential missconfiguration in .gitmodules would make it more obvious that the error might be not coming from Jenkins or GIT themselves.