[JIRA] [git-client-plugin] (JENKINS-35104) git plugin still checks out all branches when refspec set

1 view
Skip to first unread message

abendavid@cj.com (JIRA)

unread,
May 24, 2016, 3:14:02 PM5/24/16
to jenkinsc...@googlegroups.com
Allon Bendavid created an issue
 
Jenkins / Bug JENKINS-35104
git plugin still checks out all branches when refspec set
Issue Type: Bug Bug
Assignee: Mark Waite
Components: git-client-plugin, git-plugin
Created: 2016/May/24 7:13 PM
Priority: Blocker Blocker
Reporter: Allon Bendavid

We are getting a lot of these errors:

ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@gitlab:xxx/main.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1066)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at com.tikal.jenkins.plugins.multijob.MultiJobBuild$MultiJobRunnerImpl.run(MultiJobBuild.java:136)
at hudson.model.Run.execute(Run.java:1738)
at com.tikal.jenkins.plugins.multijob.MultiJobBuild.run(MultiJobBuild.java:73)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "/home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git -c core.askpass=true fetch --no-tags --progress g...@gitlab.xxx.com:xxx/main.git +refs/heads/master:refs/remotes/origin/master" returned status code 128:
stdout:
stderr: error: refs/remotes/origin/xxxx does not point to a valid object!
.....
fatal: pack has 120 unresolved deltas
fatal: index-pack failed

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
at hudson.remoting.UserRequest.perform(UserRequest.java:120)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:332)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
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 hudson.remoting.Engine$1$1.run(Engine.java:85)
at java.lang.Thread.run(Thread.java:745)
at ......remote call to build133(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
at hudson.remoting.Channel.call(Channel.java:781)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
at sun.reflect.GeneratedMethodAccessor267.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
at com.sun.proxy.$Proxy47.execute(Unknown Source)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:808)
... 12 more
ERROR: null

So I set the Refspec to +refs/heads/master:refs/remotes/origin/master
But when it does a fresh checkout (clean workspace), the plugin does this:

Notice: +refs/heads/:refs/remotes/origin/

Cloning the remote Git repository
Avoid fetching tags
Cloning repository g...@gitlab.cj.com:cjdev/main.git
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git init /home/cruise/workspace/Start # timeout=10
Fetching upstream changes from g...@gitlab.cj.com:cjdev/main.git
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git --version # timeout=10
using GIT_SSH to set credentials
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git -c core.askpass=true fetch --no-tags --progress g...@gitlab.cj.com:cjdev/main.git +refs/heads/:refs/remotes/origin/
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git config remote.origin.url g...@gitlab.cj.com:cjdev/main.git # timeout=10
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git config --add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git config remote.origin.url g...@gitlab.cj.com:cjdev/main.git # timeout=10
Fetching upstream changes from g...@gitlab.cj.com:cjdev/main.git
using GIT_SSH to set credentials
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git -c core.askpass=true fetch --no-tags --progress g...@gitlab.cj.com:cjdev/main.git +refs/heads/master:refs/remotes/origin/master
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git rev-parse refs/remotes/origin/master^

{commit} # timeout=10
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git rev-parse refs/remotes/origin/refs/heads/master^{commit}

# timeout=10
Checking out Revision b1232ff60185766b8b94dabcc20f147e25ae9aab (refs/remotes/origin/master)
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git config core.sparsecheckout # timeout=10
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git checkout -f b1232ff60185766b8b94dabcc20f147e25ae9aab
> /home/cruise/tools/hudson.plugins.git.GitTool/git-2.7.1/git rev-list 96dd700f85eb3dc07319d302e930053774c86bfc # timeout=10

which I think is what is causing the error when anything from the origin disappears.

Using latest of git plugin, and shared library plugin.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

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

unread,
May 24, 2016, 11:08:01 PM5/24/16
to jenkinsc...@googlegroups.com
Mark Waite assigned an issue to Unassigned
Change By: Mark Waite
Assignee: Mark Waite

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

unread,
May 24, 2016, 11:11:02 PM5/24/16
to jenkinsc...@googlegroups.com
Mark Waite resolved as Not A Defect
 

As far as I can tell, you're trying to clone a SHA1 whose history does not exist in the target repository because you are using shallow clone. Refer to this superuser.com article for more information on the condition.

One work around appears to be to not use shallow clone. Another that might work would be to increase the depth of the shallow clone.

Change By: Mark Waite
Status: Open Resolved
Resolution: Not A Defect

abendavid@cj.com (JIRA)

unread,
May 25, 2016, 12:52:01 PM5/25/16
to jenkinsc...@googlegroups.com
Allon Bendavid commented on Bug JENKINS-35104
 
Re: git plugin still checks out all branches when refspec set

Ok, that's weird. My comment had an asterisk after heads and origin and that results in highlighting the text between. So imagine in my initial description and comment above that I getting this: +refs/heads/[asterisk]:refs/remotes/origin/[asterisk]

abendavid@cj.com (JIRA)

unread,
May 25, 2016, 1:10:49 PM5/25/16
to jenkinsc...@googlegroups.com

Not using a 'shallow clone' though. Also if you follow the link you posted it appears unresolved for someone who did not have shallow clone enabled. I think the problem is if the workspace is clean, even if you have a Refspec set it will try and get the 'world' +refs/heads/:refs/remotes/origin/

abendavid@cj.com (JIRA)

unread,
May 25, 2016, 8:28:01 PM5/25/16
to jenkinsc...@googlegroups.com

After downloading the code for git-client and git-plugin, it appears that the issue is the in the clone command of the git-client.
Line 504 of CliGitAPIImpl.java hard codes "+refs/heads/[asterisk]:refs/remotes/origin/[asterisk]". Only after an initial clone is conducted in the workspace is does the fetch command observe the Refspec in the UI.

abendavid@cj.com (JIRA)

unread,
May 25, 2016, 9:00:01 PM5/25/16
to jenkinsc...@googlegroups.com

I have a solution for you. I'll add a pull request to your git hub that should fix the issue definitively.

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

unread,
Jul 1, 2016, 8:18:01 PM7/1/16
to jenkinsc...@googlegroups.com

Fixed for git plugin 2.5.1 by change in PR393

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

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

unread,
Oct 22, 2019, 9:31:11 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite closed an issue as Not A Defect
 
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