[JIRA] (JENKINS-18834) prune should be before fetch

12 views
Skip to first unread message

nicolas.deloof@gmail.com (JIRA)

unread,
Apr 24, 2019, 10:28:03 AM4/24/19
to jenkinsc...@googlegroups.com
Nicolas De Loof assigned an issue to Unassigned
 
Jenkins / Bug JENKINS-18834
prune should be before fetch
Change By: Nicolas De Loof
Assignee: Nicolas De Loof
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

everett.toews@gmail.com (JIRA)

unread,
Oct 31, 2019, 11:47:04 PM10/31/19
to jenkinsc...@googlegroups.com
Everett Toews commented on Bug JENKINS-18834
 
Re: prune should be before fetch

 

Can confirm this is still an issue. If the git remote prune was performed before the fetch, this wouldn't be a problem.

Following the same steps as packadal, I get this error in the console.

OpenShift Build my-project/deploy-my-service-1786 from ssh://g...@bitbucket.example.com:7999/ui/my-service.git
Checking out git ssh://g...@bitbucket.example.com:7999/ui/my-service.git into /var/lib/jenkins/jobs/my-project/jobs/my-project-deploy-my-service/workspace@script to read Jenkinsfile
using credential my-project-bitbucket-jenkins-user
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url ssh://g...@bitbucket.example.com:7999/ui/my-service.git # timeout=10
Fetching upstream changes from ssh://g...@bitbucket.example.com:7999/ui/my-service.git
 > git --version # timeout=10
using GIT_SSH to set credentials my-project-bitbucket-jenkins-user
 > git fetch --tags --progress ssh://g...@bitbucket.example.com:7999/ui/my-service.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from ssh://g...@bitbucket.example.com:7999/ui/my-service.git
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:894)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1161)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:144)
	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress ssh://g...@bitbucket.example.com:7999/ui/my-service.git +refs/heads/*:refs/remotes/origin/*" returned status code 1:
stdout: 
stderr: From ssh://bitbucket.example.com:7999/ui/my-service
 * [new branch]      automation/testpi-9 -> origin/automation/testpi-9
error: 'refs/remotes/origin/feature/foo' exists; cannot create 'refs/remotes/origin/feature/foo/bar'
 ! [new branch]      feature/foo/bar -> origin/feature/foo/bar  (unable to update local ref)
error: some local refs could not be updated; try running
 'git remote prune ssh://g...@bitbucket.example.com:7999/ui/my-service.git' to remove any old, conflicting branches	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:442)
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:892)
	... 8 more
ERROR: Error fetching remote repo 'origin'
ERROR: Maximum checkout retry attempts reached, aborting
Finished: FAILURE

 

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

everett.toews@gmail.com (JIRA)

unread,
Oct 31, 2019, 11:47:04 PM10/31/19
to jenkinsc...@googlegroups.com
Everett Toews edited a comment on Bug JENKINS-18834
Can confirm this is still an issue. If the git remote prune was performed before the fetch, this wouldn't be a problem.

Following the same steps as [~packadal], I get this error in the console.
{code:java}
{code}
 

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

unread,
Nov 1, 2019, 12:03:05 PM11/1/19
to jenkinsc...@googlegroups.com

Everett Toews that surprises me, since the --prune argument is added to the git fetch command which is used to fetch the latest updates from the remote repository.

Since the command in the output you provided does not include the -prune argument, that must indicate that the initial fetch is not honoring the prune argument. There are (unfortunately) two calls to git fetch when the git plugin retrieves changes from the remote repository. The second fetch is likely the one that would include the -prune argument.
A future optimization will be needed to remove that extra call to git fetch or a specific fix for this bug to cause that initial fetch to include the --prune argument.

You might also try adding the "Honor refspecs in initial clone" option that is available in the "Advanced clone options". It might have a side-effect of including the --prune argument in the first fetch of the repository.

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

unread,
Nov 1, 2019, 12:04:05 PM11/1/19
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-18834
[~etoews] that surprises me, since the {{--prune}} argument is added to the {{git fetch}} command which is used to fetch the latest updates from the remote repository.

Since the command in the output you provided does not include the {{
\ --prune}} argument, that must indicate that the initial fetch is not honoring the prune argument.  There are (unfortunately) two calls to {{git fetch}} when the git plugin retrieves changes from the remote repository.  The second fetch is likely the one that would include the {{ \ --prune}} argument.
A future optimization will be needed to remove that extra call to {{git fetch}} or a specific fix for this bug to cause that initial fetch to include the {{--prune}} argument.

You might also try adding the "Honor refspecs in initial clone" option that is available in the "Advanced clone options".  It might have a side-effect of including the {{--prune}} argument in the first fetch of the repository.

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

unread,
Nov 1, 2019, 12:04:06 PM11/1/19
to jenkinsc...@googlegroups.com

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

unread,
Nov 1, 2019, 12:04:06 PM11/1/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages