[JIRA] (JENKINS-37482) AbstractGitSCMSource.retrieve fails due to nonexistent cache directory

3 views
Skip to first unread message

jglick@cloudbees.com (JIRA)

unread,
Aug 17, 2016, 3:25:05 PM8/17/16
to jenkinsc...@googlegroups.com
Jesse Glick created an issue
 
Jenkins / Bug JENKINS-37482
AbstractGitSCMSource.retrieve fails due to nonexistent cache directory
Issue Type: Bug Bug
Assignee: Jesse Glick
Components: git-plugin
Created: 2016/Aug/17 7:24 PM
Labels: multibranch
Priority: Minor Minor
Reporter: Jesse Glick

Not sure if this affects production systems, or indeed why it is not reported by everyone, but anyway I was unable to make AbstractGitSCMSource.retrieve(SCMHeadObserver, TaskListener) work in a test without this fix. (And there was no test for it.) Doing so failed with:

hudson.plugins.git.GitException: Could not init $JENKINS_HOME/caches/git-4ab...
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:656)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.init(CliGitAPIImpl.java:181)
	at hudson.plugins.git.GitAPI.init(GitAPI.java:217)
	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:275)
	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:147)
	at jenkins.scm.api.SCMSource.retrieve(SCMSource.java:231)
	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:176)
	at jenkins.plugins.git.AbstractGitSCMSourceTest.retrieveHeads(AbstractGitSCMSourceTest.java:74)
	at ...
Caused by: hudson.plugins.git.GitException: Error performing command: git init $JENKINS_HOME/caches/git-4ab...
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1726)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1695)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1691)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1321)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:654)
	... 34 more
Caused by: java.io.IOException: Cannot run program "git" (in directory "$JENKINS_HOME/caches/git-4ab..."): error=2, No such file or directory
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at hudson.Proc$LocalProc.<init>(Proc.java:244)
	at hudson.Proc$LocalProc.<init>(Proc.java:216)
	at hudson.Launcher$LocalLauncher.launch(Launcher.java:803)
	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1715)
	... 38 more
Caused by: java.io.IOException: error=2, No such file or directory
	at java.lang.UNIXProcess.forkAndExec(Native Method)
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
	at java.lang.ProcessImpl.start(ProcessImpl.java:134)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	... 43 more

Perhaps some, but not all, versions of git-client barf if you try to run git init in a nonexistent directory?

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Aug 17, 2016, 3:34:05 PM8/17/16
to jenkinsc...@googlegroups.com
Jesse Glick started work on Bug JENKINS-37482
 
Change By: Jesse Glick
Status: Open In Progress

jglick@cloudbees.com (JIRA)

unread,
Aug 17, 2016, 3:34:05 PM8/17/16
to jenkinsc...@googlegroups.com

mark.earl.waite@gmail.com (JIRA)

unread,
Aug 17, 2016, 9:43:02 PM8/17/16
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-37482
 
Re: AbstractGitSCMSource.retrieve fails due to nonexistent cache directory

Thanks for the pull request to resolve this.

The JGit implementation in git-client will create the directory if it does not already exist. That's why this condition was not detected previously by those using the multi-branch pipeline plugins. They previously only used the JGit implementation. The command line implementation in git client does not create the directory if it does not already exist.

PR424 detected that same condition and has a change pending in the git client command line implementation to create the directory if it does not already exist.

scm_issue_link@java.net (JIRA)

unread,
Aug 19, 2016, 8:13:02 AM8/19/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Jesse Glick
Path:
src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java
src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java
http://jenkins-ci.org/commit/git-plugin/af7d9bba81c97f3f405a848069884522188fe118
Log:
[FIXED JENKINS-37482] Make the cache directory, not just its parent.

scm_issue_link@java.net (JIRA)

unread,
Aug 22, 2016, 12:00:01 AM8/22/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Mark Waite
Path:
src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java
src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java
http://jenkins-ci.org/commit/git-plugin/fc65311b728d1c514beae8bc97e539eb214d3776
Log:
Merge pull request #432 from jglick/mkdirs-JENKINS-37482

JENKINS-37482 Make the cache directory, not just its parent

mark.earl.waite@gmail.com (JIRA)

unread,
Aug 22, 2016, 12:12:02 AM8/22/16
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-37482
Thanks for the pull request to resolve this.

The JGit implementation in git-client will create the directory if it does not already exist.  That's why this condition was not detected previously by those using the multi-branch pipeline plugins.  They previously only used the JGit implementation.  The command line implementation in git client does not create the directory if it does not already exist.

[PR424|https://github.com/jenkinsci/git-plugin/pull/424] detected that same condition and has a [change pending in the git client command line implementation|https://github.com/MarkEWaite/git-client-plugin/commit/486d2af6df09ce71b11261c7648b607cd51f8541] to create the directory if it does not already exist.

jglick@cloudbees.com (JIRA)

unread,
Aug 22, 2016, 12:23:01 PM8/22/16
to jenkinsc...@googlegroups.com

mark.earl.waite@gmail.com (JIRA)

unread,
Sep 2, 2016, 2:56:01 PM9/2/16
to jenkinsc...@googlegroups.com

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 9:33:52 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite closed an issue as Fixed
 
Change By: Mark Waite
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages