My Jenkins is running on a docker container, that itself is running on a VM (we'll call it VM 1). The agent is a windows agent on a VM running on VM 1 that is trying to clone a repo from a network drive. The network drive is already mounted inside the docker container at /mnt/h/. When I launch the project, I get an error and tt seems like the git plugin concatenates the git.exe path and the repo to clone in the error message as you can see by this line:
16:49:59 stderr: fatal: 'C:/Program Files/Git/mnt/h/GIT_NEW' does not appear to be a git repository
16:49:58 Started by user SmusJenkins
16:49:58 Running as SYSTEM
16:49:58 Building remotely on Smusjenkins VM (FAMUS) in workspace C:/Jenkins/workspace/FAMUS
16:49:58 The recommended git tool is: NONE
16:49:58 No credentials specified
16:49:58 Wiping out workspace first.
16:49:58 Cloning the remote Git repository
16:49:58 Cloning repository file:///mnt/h/GIT_NEW
16:49:58 > C:\Program Files\Git\bin\git.exe init C:\Jenkins\workspace\FAMUS # timeout=10
16:49:59 Fetching upstream changes from file:///mnt/h/GIT_NEW
16:49:59 > C:\Program Files\Git\bin\git.exe --version # timeout=10
16:49:59 > git --version # 'git version 2.38.1.windows.1'
16:49:59 > C:\Program Files\Git\bin\git.exe fetch --tags --force --progress -- file:///mnt/h/GIT_NEW refs/heads/*:refs/remotes/origin/* # timeout=10
16:49:59 ERROR: Error cloning remote repo 'origin'
16:49:59 hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe fetch --tags --force --progress -- file:///mnt/h/GIT_NEW refs/heads/*:refs/remotes/origin/*" returned status code 128:
16:49:59 stdout:
16:49:59 stderr: fatal: 'C:/Program Files/Git/mnt/h/GIT_NEW' does not appear to be a git repository
16:49:59 fatal: Could not read from remote repository.
16:49:59
16:49:59 Please make sure you have the correct access rights
16:49:59 and the repository exists.
16:49:59
16:49:59 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2697)
16:49:59 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2111)
16:49:59 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:87)
16:49:59 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:623)
16:49:59 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:852)
16:49:59 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:158)
16:49:59 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:151)
16:49:59 at hudson.remoting.UserRequest.perform(UserRequest.java:211)
16:49:59 at hudson.remoting.UserRequest.perform(UserRequest.java:54)
16:49:59 at hudson.remoting.Request$2.run(Request.java:376)
16:49:59 at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
16:49:59 at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
16:49:59 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
16:49:59 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
16:49:59 at java.base/java.lang.Thread.run(Thread.java:1589)
16:49:59 Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to Smusjenkins VM
16:49:59 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1784)
16:49:59 at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
16:49:59 at hudson.remoting.Channel.call(Channel.java:1000)
16:49:59 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:143)
16:49:59 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:49:59 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
16:49:59 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
16:49:59 at java.base/java.lang.reflect.Method.invoke(Method.java:566)
16:49:59 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:129)
16:49:59 at com.sun.proxy.$Proxy170.execute(Unknown Source)
16:49:59 at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1229)
16:49:59 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1312)
16:49:59 at hudson.scm.SCM.checkout(SCM.java:540)
16:49:59 at hudson.model.AbstractProject.checkout(AbstractProject.java:1239)
16:49:59 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:647)
16:49:59 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
16:49:59 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:519)
16:49:59 at hudson.model.Run.execute(Run.java:1899)
16:49:59 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
16:49:59 at hudson.model.ResourceController.execute(ResourceController.java:107)
16:49:59 at hudson.model.Executor.run(Executor.java:449)
16:49:59 ERROR: Error cloning remote repo 'origin'
16:49:59 Finished: FAILURE
Any ideas how I can fix this?
CodePudding user response:
Turns out jenkins didn't like the network drive. I added the windows path to the network drive and things worked.
Found my anwser here: https://stackoverflow.com/a/7417626/13689733