[JIRA] [git] (JENKINS-20258) Git plugin with checkout to subdir and prune stale branches fails all builds

120 views
Skip to first unread message

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

unread,
Dec 16, 2013, 9:26:01 PM12/16/13
to jenkinsc...@googlegroups.com

Git client plugin 1.5.0 was intended to fix this (based on the submission ba2ab8934), but it still fails.

Steps I used to duplicate the problem with Git client plugin 1.5.0:

  1. Create a new job (I named mine git-jgit-specific-subdir-prune)
  2. Configure git repo URL https://github.com/MarkEWaite/check_git.git
  3. Add behavior to checkout to a local subdirectory
  4. Add behavior to prune stale remote tracking branches
  5. Save the job and run it
Change By: Mark Waite (17/Dec/13 2:25 AM)
Resolution: Fixed
Status: Resolved Reopened
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

unread,
Dec 16, 2013, 9:28:00 PM12/16/13
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-20258

Git client plugin 1.5.0 was intended to fix this (based on the submission ba2ab8934), but it still fails.

Steps I used to duplicate the problem with Git client plugin 1.5.0:

  1. Create a new job (I named mine git-jgit-specific-subdir-prune)
  2. Configure git repo URL https://github.com/MarkEWaite/check_git.git
  1. Use jgit as the implementation rather than the default
  1. Add behavior to checkout to a local subdirectory
  2. Add behavior to prune stale remote tracking branches
  3. Save the job and run it

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

unread,
Dec 16, 2013, 9:30:01 PM12/16/13
to jenkinsc...@googlegroups.com

Git client plugin 1.5.0 was intended to fix this (based on the submission ba2ab8934), but it still fails.

Steps I used to duplicate the problem with Git client plugin 1.5.0:

  1. Create a new job (I named mine git-jgit-specific-subdir-prune)
  2. Configure git repo URL https://github.com/MarkEWaite/check_git.git
  3. Use jgit as the implementation rather than the default
  4. Add behavior to checkout to a local subdirectory
  5. Add behavior to prune stale remote tracking branches
  6. Save the job and run it

Stack trace looks like:

Building on master in workspace /var/lib/jenkins/jobs/git-jgit-specific-subdir-prune-simple/workspace
Pruning obsolete local branches
FATAL: java.net.URISyntaxException: Cannot parse Git URI-ish: The uri was empty or null
hudson.plugins.git.GitException: java.net.URISyntaxException: Cannot parse Git URI-ish: The uri was empty or null
at org.jenkinsci.plugins.gitclient.JGitAPIImpl.prune(JGitAPIImpl.java:913)
at hudson.plugins.git.extensions.impl.PruneStaleBranch.beforeCheckout(PruneStaleBranch.java:31)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:858)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:652)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:557)
at hudson.model.Run.execute(Run.java:1665)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:246)
Caused by: java.net.URISyntaxException: Cannot parse Git URI-ish: The uri was empty or null
at org.eclipse.jgit.transport.URIish.<init>(URIish.java:205)
at org.jenkinsci.plugins.gitclient.JGitAPIImpl.listRemoteBranches(JGitAPIImpl.java:923)
at org.jenkinsci.plugins.gitclient.JGitAPIImpl.prune(JGitAPIImpl.java:901)
... 10 more

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

unread,
Dec 16, 2013, 9:32:01 PM12/16/13
to jenkinsc...@googlegroups.com

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

unread,
Dec 16, 2013, 9:32:01 PM12/16/13
to jenkinsc...@googlegroups.com

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

unread,
Dec 16, 2013, 9:32:01 PM12/16/13
to jenkinsc...@googlegroups.com

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

unread,
Dec 16, 2013, 9:34:00 PM12/16/13
to jenkinsc...@googlegroups.com

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

unread,
Dec 16, 2013, 9:36:00 PM12/16/13
to jenkinsc...@googlegroups.com
Change By: Mark Waite (17/Dec/13 2:35 AM)
Description: I configured a job with the git 2.0 plugin to checkout to a specific subdirectory and to prune stale branches.  That pair of configuration settings cause the initial git operations to fail with both git command line and jgit implementations.

The stack trace for the command line implementation is:

{noformat}
Started by user anonymous
Building remotely on alan-pc in workspace C:\J\workspace\git-multi-subdir-prune
Pruning obsolete local branches
FATAL: Command "config --get remote.origin.url" returned status code 1:
stdout: 
stderr: 
hudson.plugins.git.GitException: Command "config --get remote.origin.url" returned status code 1:
stdout: 
stderr: 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:940)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:921)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:865)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:875)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getRemoteUrl(CliGitAPIImpl.java:603)
at hudson.plugins.git.GitAPI.getRemoteUrl(GitAPI.java:61)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.prune(CliGitAPIImpl.java:393)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:299)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1$1.run(Engine.java:63)
at java.lang.Thread.run(Unknown Source)
{noformat}

The stack trace for the jgit implementation is:

{noformat}
Started by an SCM change
Started by user anonymous
Building remotely on waite2011 in workspace D:\J\workspace\git-multi-jgit-subdir-prune

Pruning obsolete local branches
FATAL: java.net.URISyntaxException: Cannot parse Git URI-ish: The uri was empty or null
hudson.plugins.git.GitException: java.net.URISyntaxException: Cannot parse Git URI-ish: The uri was empty or null
at org.jenkinsci.plugins.gitclient.JGitAPIImpl.prune(JGitAPIImpl.java:869)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:299)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1$1.run(Engine.java:63)
at java.lang.Thread.run(Unknown Source)

Caused by: java.net.URISyntaxException: Cannot parse Git URI-ish: The uri was empty or null
at org.eclipse.jgit.transport.URIish.<init>(URIish.java:205)
at org.jenkinsci.plugins.gitclient.JGitAPIImpl.listRemoteBranches(JGitAPIImpl.java:879)
at org.jenkinsci.plugins.gitclient.JGitAPIImpl.prune(JGitAPIImpl.java:857)
... 16 more

{noformat}

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

unread,
Feb 6, 2014, 1:17:38 AM2/6/14
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-20258

This is fixed for the command line implementation in git-client-plugin 1.6.2 and git-plugin 2.0.1.

It is not fixed in the JGit implementation but it now reports a much clearer error message:

Started by user anonymous
Building remotely on jessie64a in workspace /var/lib/jenkins/wheezy64b-slave/workspace/JENKINS-20258-checkout-to-subdir-and-prune-jgit
Cloning the remote Git repository
remote: Counting objects
remote: Compressing objects
Receiving objects
Resolving deltas
Updating references
Pruning obsolete local branches
FATAL: Failed to fetch from git://wheezy64b/git/mwaite/bin.git
hudson.plugins.git.GitException: Failed to fetch from git://wheezy64b/git/mwaite/bin.git
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:625)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:847)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:872)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:652)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:557)
	at hudson.model.Run.execute(Run.java:1665)
	at hudson.matrix.MatrixBuild.run(MatrixBuild.java:304)
	at hudson.model.ResourceController.execute(ResourceController.java:88)
	at hudson.model.Executor.run(Executor.java:246)
	at hudson.model.OneOffExecutor.run(OneOffExecutor.java:66)
Caused by: hudson.plugins.git.GitException: java.lang.reflect.InvocationTargetException
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:156)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
	at hudson.remoting.Request$2.run(Request.java:326)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$Invocation.replay(RemoteGitImpl.java:101)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:151)
	... 9 more
Caused by: java.lang.UnsupportedOperationException: JGit don't (yet) support pruning during fetch
	at org.jenkinsci.plugins.gitclient.JGitAPIImpl$1.prune(JGitAPIImpl.java:375)
	... 15 more

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

unread,
Feb 6, 2014, 1:17:39 AM2/6/14
to jenkinsc...@googlegroups.com
 
Mark Waite edited a comment on Bug JENKINS-20258

This is fixed for the command line implementation in git-client-plugin 1.6.2 and git-plugin 2.0.1.

It is not fixed in the JGit implementation but it now reports a much clearer error message:

JGit don't (yet) support pruning during fetch

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

unread,
Feb 6, 2014, 1:19:38 AM2/6/14
to jenkinsc...@googlegroups.com
Mark Waite resolved Bug JENKINS-20258 as Fixed

No fix intended for JGit implementation. Works in command line and clearly states that it is not implemented in JGit.

Change By: Mark Waite (06/Feb/14 6:18 AM)
Status: Reopened Resolved
Resolution: Fixed

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

unread,
Feb 6, 2014, 1:19:38 AM2/6/14
to jenkinsc...@googlegroups.com
Mark Waite closed Bug JENKINS-20258 as Fixed
Change By: Mark Waite (06/Feb/14 6:18 AM)
Status: Resolved Closed

pmv@java.net (JIRA)

unread,
Dec 19, 2014, 3:40:08 PM12/19/14
to jenkinsc...@googlegroups.com
pmv commented on Bug JENKINS-20258

It looks like JGit 3.3 can now do pruning? "Support fetch.prune and remote.<name>.prune to set prune mode when fetching" - https://wiki.eclipse.org/JGit/New_and_Noteworthy/3.3

Should a new ticket be opened to get this fix applied to the JGit implementation?

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

unread,
Dec 19, 2014, 5:59:08 PM12/19/14
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-20258

Code already exists in the JGit implementation to evaluate the prune implementation that was included in JGit 3.3. Unfortunately, the JGit 3.3 prune removes more branches than command line git. Since that would give incompatible behavior between CliGit and JGit, and CliGit is the reference implementation, the JGit prune at fetch can't be enabled.

Refer to this submission which attempted to use JGit prune with JGit 3.5.2 and confirmed that it is still pruning too many branches.

pmv@java.net (JIRA)

unread,
Dec 22, 2014, 12:08:08 PM12/22/14
to jenkinsc...@googlegroups.com
pmv commented on Bug JENKINS-20258

Thanks for the update. Is there an open ticket I can watch for this feature (rather than commenting on this old one)?

Personally I'd be in favor of a "use this feature with JGit at your own risk" message rather than not supporting prune at all, but I understand your logic.

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

unread,
Dec 22, 2014, 12:37:07 PM12/22/14
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-20258

I've been unwilling to accept incompatible behavior between CliGit and JGit. Use at your own risk seems too risky for a plugin used in over 50 000 installations.

You're welcome to open a separate bug report / enhancement request to track it. That seems like it will make it easier to track, and easier to report the problem to the upstream JGit process.

pmv@java.net (JIRA)

unread,
Dec 22, 2014, 3:40:08 PM12/22/14
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages