-
Bug
-
Resolution: Won't Fix
-
Minor
-
None
-
os: CentOS 7
jdk: openjdk-1.8.0.191
Jenkins version 2.210
git client: 3.0.0
A multibranch pipeline jobs is configured for a git repo. Scanning the branch index ends with an excpetion from git client:
Mon Jan 27 09:21:00 CET 2020] Starting branch indexing... > git --version # timeout=10 using GIT_ASKPASS to set credentials User for XXX bitbucket instance Setting http proxy: XXX.XXX.XXX.X:9090 > git ls-remote https://bitbucket.xxx.yy/somewhat.git # timeout=10 ERROR: [Mon Jan 27 09:21:01 CET 2020] Could not update folder level actions from source <uuid ommited> hudson.plugins.git.GitException: Command "git ls-remote https://bitbucket.xxx.yy/somewhat.git" returned status code 128: stdout: stderr: fatal: unable to access '.git/config': Permission denied at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2372) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1985) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1885) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1876) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getRemoteReferences(CliGitAPIImpl.java:3228) at jenkins.plugins.git.AbstractGitSCMSource.retrieveActions(AbstractGitSCMSource.java:1141) at jenkins.scm.api.SCMSource.fetchActions(SCMSource.java:848) at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:598) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:277) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:164) at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1032) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:428) [Mon Jan 27 09:21:01 CET 2020] Finished branch indexing. Indexing took 91 ms
It seems, that git client plugin tries to run the git ls-remote command somewhere, where the jenkins instance does not have write access to.
By looking into the code, I saw that
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getRemoteReferences
does not define a workdir for the git command call and so the process default workdir is chosen.
The pwd of the java vm running jenkins is /
That would explain the problem.
Idea: Use java.io.tmpdir to get a good workdir, if nothing else fits.