[JIRA] (JENKINS-45997) BitBucket PRs failing to checkout on initial run after PR updated with new commits

9 views
Skip to first unread message

nickbroon@gmail.com (JIRA)

unread,
Mar 14, 2018, 7:53:03 AM3/14/18
to jenkinsc...@googlegroups.com
Nicholas Brown commented on Bug JENKINS-45997
 
Re: BitBucket PRs failing to checkout on initial run after PR updated with new commits

I think Justin Wojciechowski solution of having the Bitbucket Branch Source Plugin hit the CanMerge Rest API, to force the branch creations, is a good one. It need not even be a configuration option, Bitbucket Branch Source Plugin should simply do this every time it discovers PRs.

In a some older Jenkins jobs I had, not making use of Bitbucket Branch Source Plugin, I had the same issue and used this horrid work around:

# Nasty hack to force Stash to generate the /merge branch for the PR
set +x
curl -u ${STASH_USER}:${STASH_PASSWORD} ${STASH_URL}/rest/api/1.0/projects/${destinationRepositoryOwner}/repos/${destinationRepositoryName}/pull-requests/${pullRequestId}/diff > /dev/null
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

patrick@tario.org (JIRA)

unread,
Mar 17, 2018, 9:56:06 AM3/17/18
to jenkinsc...@googlegroups.com

i@soar.name (JIRA)

unread,
Apr 16, 2018, 12:56:03 PM4/16/18
to jenkinsc...@googlegroups.com

I've faced same problem today - but with GitHub and it's Pull Requests:

Pull request #339 updated
16:23:22 Connecting to https://api.github.com using botaccount/****** (botaccount-github-userpass)
Checking out git g...@github.com:team/project.git into /var/jenkins_home/workspace/team_unilanding_PR-339-QD7W5G5UCQBK3XJQYNPM6GQDRVGPY6TQABV6SD4RWHXU2EDQR65A@script to read Jenkinsfile
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url g...@github.com:team/project.git # timeout=10
Fetching without tags
Fetching upstream changes from g...@github.com:team/project.git
 > git --version # timeout=10
using GIT_SSH to set credentials botaccount-github-ssh-key
 > git fetch --no-tags --progress g...@github.com:team/project.git +refs/pull/339/head:refs/remotes/origin/PR-339 +refs/heads/master:refs/remotes/origin/master
Merging remotes/origin/master commit bb79fa5bd122fa0fac4608d10a9ccd41dc2e72f7 into PR head commit dc38ea253251ca79a4587c20b25b425ede135de7
 > git config core.sparsecheckout # timeout=10
 > git checkout -f dc38ea253251ca79a4587c20b25b425ede135de7

GitHub has been notified of this commit’s build result

hudson.plugins.git.GitException: Command "git checkout -f dc38ea253251ca79a4587c20b25b425ede135de7" returned status code 128:
stdout:
stderr: fatal: reference is not a tree: dc38ea253251ca79a4587c20b25b425ede135de7

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1996)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$800(CliGitAPIImpl.java:72)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2295)
Caused: hudson.plugins.git.GitException: Could not checkout dc38ea253251ca79a4587c20b25b425ede135de7
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2319)
    at jenkins.plugins.git.MergeWithGitSCMExtension.checkout(MergeWithGitSCMExtension.java:146)
    at jenkins.plugins.git.MergeWithGitSCMExtension.decorateRevisionToBuild(MergeWithGitSCMExtension.java:112)
    at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1068)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1161)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:143)
    at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:295)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

 

Only closing old PR and re-creating it can solve this problem. Need this fix for GitHub.

dev@jakobjarosch.de (JIRA)

unread,
Apr 23, 2018, 12:27:03 PM4/23/18
to jenkinsc...@googlegroups.com

What is currently blocking the pull request from being merged?

patrick@tario.org (JIRA)

unread,
Jun 7, 2018, 4:40:02 AM6/7/18
to jenkinsc...@googlegroups.com
Patrick Ruckstuhl started work on Bug JENKINS-45997
 
Change By: Patrick Ruckstuhl
Status: Open In Progress

patrick@tario.org (JIRA)

unread,
Jun 7, 2018, 4:41:06 AM6/7/18
to jenkinsc...@googlegroups.com

patrick@tario.org (JIRA)

unread,
Jun 7, 2018, 4:41:06 AM6/7/18
to jenkinsc...@googlegroups.com

stephan.vedder@gmail.com (JIRA)

unread,
Jun 26, 2018, 10:59:02 AM6/26/18
to jenkinsc...@googlegroups.com
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

kuenstler@mail.de (JIRA)

unread,
Jun 26, 2018, 11:50:03 AM6/26/18
to jenkinsc...@googlegroups.com

What i don't get:

  • Bitbucket has this lazy-disc-refs behaviour this since 1.3.0
  • we're experiencing this bug only after we  updated bitbucket-branch-source-plugin to 2.2.8

so why did it work before?

patrick@tario.org (JIRA)

unread,
Jun 26, 2018, 12:46:01 PM6/26/18
to jenkinsc...@googlegroups.com

There is a fix for this in my pr and it's waiting to get merged.

mrkita@live.com (JIRA)

unread,
Jun 27, 2018, 8:58:03 AM6/27/18
to jenkinsc...@googlegroups.com

Hey Patrick, any idea what's the hold up? At our company there are multiple projects that would immediately benefit from this

patrick@tario.org (JIRA)

unread,
Jun 27, 2018, 9:20:02 AM6/27/18
to jenkinsc...@googlegroups.com

Unfortunately no idea. It's waiting forever and was reviewed and approved by multiple people and I think even the main maintainer.

torsten.kleiber@ikb.de (JIRA)

unread,
Jun 28, 2018, 5:01:02 AM6/28/18
to jenkinsc...@googlegroups.com

airey.andy+jenkins@gmail.com (JIRA)

unread,
Jun 28, 2018, 9:53:03 AM6/28/18
to jenkinsc...@googlegroups.com

Devs were pinged on the github PR, please follow the potential discussion there.

airey.andy+jenkins@gmail.com (JIRA)

unread,
Jun 28, 2018, 9:54:05 AM6/28/18
to jenkinsc...@googlegroups.com
Andy Airey edited a comment on Bug JENKINS-45997
Devs were pinged on the github PR, please follow the potential discussion there.


Comments like #meToo are useless and just generates SPAM, please use the vote button.

nickbroon@gmail.com (JIRA)

unread,
Jul 6, 2018, 6:19:04 AM7/6/18
to jenkinsc...@googlegroups.com

nickbroon@gmail.com (JIRA)

unread,
Jul 6, 2018, 6:19:08 AM7/6/18
to jenkinsc...@googlegroups.com

bart.devriendt@kbc.be (JIRA)

unread,
Jul 6, 2018, 8:33:04 AM7/6/18
to jenkinsc...@googlegroups.com
Bart Devriendt reopened an issue
 

I updated the plugin to latest version and followed the steps to reproduce the error.  It still fails with the same error (reference is not a tree)

Change By: Bart Devriendt
Resolution: Fixed
Status: Resolved Reopened

bart.devriendt@kbc.be (JIRA)

unread,
Jul 6, 2018, 8:37:04 AM7/6/18
to jenkinsc...@googlegroups.com
Bart Devriendt commented on Bug JENKINS-45997
 
Re: BitBucket PRs failing to checkout on initial run after PR updated with new commits

Ok, nevermind, I forgot to enable "call can merge".  Can be closed again !

kit.plummer@gtri.gatech.edu (JIRA)

unread,
Jul 6, 2018, 8:40:03 AM7/6/18
to jenkinsc...@googlegroups.com

patrick@tario.org (JIRA)

unread,
Jul 6, 2018, 8:54:03 AM7/6/18
to jenkinsc...@googlegroups.com

Kit Plummer can you verify, that you enabled the option "Call can merge" on the configuration? Per default this is not enabled to keep the same functionality as before.

kit.plummer@gtri.gatech.edu (JIRA)

unread,
Jul 6, 2018, 9:21:02 AM7/6/18
to jenkinsc...@googlegroups.com

I've not updated servers yet, opting to wait for confirmation in a release.  Not trying to be a prat, just want to ensure/confirm before we update.

sanzjoan@gmail.com (JIRA)

unread,
Jul 6, 2018, 11:14:02 AM7/6/18
to jenkinsc...@googlegroups.com

I can confirm this fix is working correctly, thanks very much!

patrick@tario.org (JIRA)

unread,
Jul 6, 2018, 4:35:04 PM7/6/18
to jenkinsc...@googlegroups.com

kevin.deberk@brightcomputing.com (JIRA)

unread,
Jul 13, 2018, 5:06:04 AM7/13/18
to jenkinsc...@googlegroups.com
Kevin de Berk commented on Bug JENKINS-45997
 
Re: BitBucket PRs failing to checkout on initial run after PR updated with new commits
Branch indexing
ERROR: Could not do lightweight checkout, falling back to heavyweight
java.io.FileNotFoundException: URL: /rest/api/1.0/projects/CM/repos/cluster-on-demand/browse/shorttests.Jenkinsfile?at=PR-707&start=0&limit=500
	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:674)
	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getFileContent(BitbucketServerAPIClient.java:917)
	at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:99)
	at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:338)
	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:104)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:271)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
Checking out git http://path/to/repo.git into /var/jenkins_home/workspace/on-demand-shorttests_PR-707-SKHG6SSGE4M6QOKODSY4Z7BTHANSQZJDBDYXNL6B2X3LOF2TPZWA@script to read shorttests.Jenkinsfile
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url http://bitbucket.brightcomputing.com:7990/scm/CM/cluster-on-demand.git # timeout=10
Fetching without tags
Fetching upstream changes from http://bitbucket.brightcomputing.com:7990/scm/CM/cluster-on-demand.git
 > git --version # timeout=10
using GIT_ASKPASS to set credentials Jenkins Bitbucket User
 > git fetch --no-tags --progress http://path/to.repo.git +refs/pull-requests/707/from:refs/remotes/origin/PR-707
Checking out Revision b34d5652ec5caa525eb2d4aa90b3505bdc2e5584 (PR-707)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f b34d5652ec5caa525eb2d4aa90b3505bdc2e5584
[Bitbucket] Notifying pull request build result
[Bitbucket] Build result notified
hudson.plugins.git.GitException: Command "git checkout -f b34d5652ec5caa525eb2d4aa90b3505bdc2e5584" returned status code 128:
stdout: 
stderr: fatal: reference is not a tree: b34d5652ec5caa525eb2d4aa90b3505bdc2e5584

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2002)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$800(CliGitAPIImpl.java:72)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2301)
Caused: hudson.plugins.git.GitException: Could not checkout b34d5652ec5caa525eb2d4aa90b3505bdc2e5584
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2325)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1236)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:143)
	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:271)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

The fix does not appear to be working for us here. Installed and running version of the Bitbucket Branch Source Plugin plugin is 2.2.12.

kevin.deberk@brightcomputing.com (JIRA)

unread,
Jul 13, 2018, 5:07:02 AM7/13/18
to jenkinsc...@googlegroups.com
Kevin de Berk edited a comment on Bug JENKINS-45997
{noformat}

Branch indexing
ERROR: Could not do lightweight checkout, falling back to heavyweight
java.io.FileNotFoundException: URL: /rest/api/1.0/projects/CM/repos/cluster-on-demand/browse/shorttests.Jenkinsfile?at=PR-707&start=0&limit=500
at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:674)
at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getFileContent(BitbucketServerAPIClient.java:917)
at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:99)
at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:338)
at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:104)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:271)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Checking out git http://path/to/repo.git into /var/jenkins_home/workspace/ on repo_PR - demand-shorttests_PR- 707-SKHG6SSGE4M6QOKODSY4Z7BTHANSQZJDBDYXNL6B2X3LOF2TPZWA@script to read shorttests.Jenkinsfile

> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url http:// bitbucket.brightcomputing.com:7990 path / scm to / CM/cluster-on-demand repo .git # timeout=10
Fetching without tags
Fetching upstream changes from http://
bitbucket.brightcomputing.com:7990 path / scm to / CM/cluster-on-demand repo .git

> git --version # timeout=10
using GIT_ASKPASS to set credentials Jenkins Bitbucket User
> git fetch --no-tags --progress http://path/to.repo.git +refs/pull-requests/707/from:refs/remotes/origin/PR-707
Checking out Revision b34d5652ec5caa525eb2d4aa90b3505bdc2e5584 (PR-707)
> git config core.sparsecheckout # timeout=10
> git checkout -f b34d5652ec5caa525eb2d4aa90b3505bdc2e5584
[Bitbucket] Notifying pull request build result
[Bitbucket] Build result notified
hudson.plugins.git.GitException: Command "git checkout -f b34d5652ec5caa525eb2d4aa90b3505bdc2e5584" returned status code 128:
stdout:
stderr: fatal: reference is not a tree: b34d5652ec5caa525eb2d4aa90b3505bdc2e5584

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2002)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$800(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2301)
Caused: hudson.plugins.git.GitException: Could not checkout b34d5652ec5caa525eb2d4aa90b3505bdc2e5584
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2325)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1236)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:143)
at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:271)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE
{noformat}


The fix does not appear to be working for us here. Installed and running version of the Bitbucket Branch Source Plugin plugin is 2.2.12.

patrick@tario.org (JIRA)

unread,
Jul 13, 2018, 5:23:01 AM7/13/18
to jenkinsc...@googlegroups.com

Kevin de Berk did you enable the "Call Can Merge" in the Bitbucket Endpoints configuration?

kevin.deberk@brightcomputing.com (JIRA)

unread,
Jul 13, 2018, 5:26:02 AM7/13/18
to jenkinsc...@googlegroups.com

Sorry, I wasn't aware that action was needed on both jira and bitbucket. I don't have direct access to the bitbucket server, so I'll have to check with the admin.

patrick@tario.org (JIRA)

unread,
Jul 13, 2018, 5:29:02 AM7/13/18
to jenkinsc...@googlegroups.com

patrick@tario.org (JIRA)

unread,
Jul 13, 2018, 5:30:07 AM7/13/18
to jenkinsc...@googlegroups.com

patrick@tario.org (JIRA)

unread,
Jul 13, 2018, 5:30:10 AM7/13/18
to jenkinsc...@googlegroups.com

kevin.deberk@brightcomputing.com (JIRA)

unread,
Jul 13, 2018, 5:35:06 AM7/13/18
to jenkinsc...@googlegroups.com
Kevin de Berk updated an issue
Change By: Kevin de Berk
Attachment: Screenshot from 2018-07-13 11-33-59.png

kevin.deberk@brightcomputing.com (JIRA)

unread,
Jul 13, 2018, 5:35:12 AM7/13/18
to jenkinsc...@googlegroups.com

patrick@tario.org (JIRA)

unread,
Jul 13, 2018, 5:37:07 AM7/13/18
to jenkinsc...@googlegroups.com

kevin.deberk@brightcomputing.com (JIRA)

unread,
Jul 13, 2018, 5:37:08 AM7/13/18
to jenkinsc...@googlegroups.com
Kevin de Berk edited a comment on Bug JENKINS-45997
I have nothing that looks like that . We're using a multibranch project.

!Screenshot from 2018-07-13 11-33-59.png|thumbnail!

kevin.deberk@brightcomputing.com (JIRA)

unread,
Jul 13, 2018, 5:43:11 AM7/13/18
to jenkinsc...@googlegroups.com

It seems to be working now! Thanks for the help and quick response!

It took me a while before I could find the option that you and other people here were referring to. I don't understand why a google search for "Call can merge" (with quotes!) only generates 2 results, of which one is this page and the other completely irrelevant.

kevin.deberk@brightcomputing.com (JIRA)

unread,
Jul 13, 2018, 5:43:13 AM7/13/18
to jenkinsc...@googlegroups.com
Kevin de Berk edited a comment on Bug JENKINS-45997
I have nothing that looks like that. We're using a multibranch project.

!Screenshot from 2018-07-13 11-33-59.png|thumbnail!

kevin.deberk@brightcomputing.com (JIRA)

unread,
Jul 13, 2018, 5:44:03 AM7/13/18
to jenkinsc...@googlegroups.com
Kevin de Berk edited a comment on Bug JENKINS-45997
{noformat}
Branch indexing
ERROR: Could not do lightweight checkout, falling back to heavyweight
java.io.FileNotFoundException: URL: /rest/api/1.0/projects/CM/repos/cluster-on-demand/browse/shorttests.Jenkinsfile?at=PR-707&start=0&limit=500
at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:674)
at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getFileContent(BitbucketServerAPIClient.java:917)
at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:99)
at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:338)
at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:104)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:271)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Checking out git http://path/to/repo.git into /var/jenkins_home/workspace/repo_PR-707-SKHG6SSGE4M6QOKODSY4Z7BTHANSQZJDBDYXNL6B2X3LOF2TPZWA@script to read shorttests.Jenkinsfile

> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url http://path/to/repo.git # timeout=10
Fetching without tags
Fetching upstream changes from http://path/to/repo.git


RESOLVED: Was resolved by enabling "Call can merge" on the global jenkins configuration page. See discussion below.

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

unread,
Nov 30, 2018, 5:44:04 PM11/30/18
to jenkinsc...@googlegroups.com

It seems that the "Call can merge" selection is only available for Bitbucket Server connections, not for connections to Bitbucket.org. I assume that is because it is not needed when connecting to Bitbucket.org. I was unable to duplicate this bug report with Bitbucket.org.

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

damyan.yordanov@itk-engineering.de (JIRA)

unread,
Jan 29, 2019, 6:23:03 AM1/29/19
to jenkinsc...@googlegroups.com

Confirmation: when the "call can merge" is not set, an error message "reference is not a tree" occurrs, when trying to build a PR. Setting the option seems to fix the issue on our internal Bitbucket Server. Thank you!

joerg.schwaerzler@infineon.com (JIRA)

unread,
Jul 8, 2019, 11:17:05 AM7/8/19
to jenkinsc...@googlegroups.com

Not sure whether this is the same issue. But this is the closet ticket I could find.
For us Bitbucket + Branch Source plugin was working just find - until today. Now for one of our repositories I cannot convince Jenkins to clone the repository correctly ritght after a PR was updated or created.

Now we always would have to re-trigger each PR build manually in order to get it running. Once triggered automatically the builds won't work (see below).
Furthermore - other, unrelated jobs which are trying to clone the repository at the very same point in time when the PR is updated and which are not even trying to check out the pull request revision but master (of the same repository) - happen to fail with the very same error messages!

Not sure whether this would be an issue in Bitbucket or in Jenkins git plugin or Bitbucket branch source plugin. Maybe somebody can comment.

The error message is either:

Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --no-tags --progress https://******* +refs/pull-requests/66/from:refs/remotes/origin/PR-66" returned status code 128:
stdout: 
stderr: fatal: Couldn't find remote ref refs/pull-requests/66/from

or something like (using a slightly different refspec):

git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* +refs/pull-requests/*/merge:refs/remotes/origin/PR-*" returned status code 128:
stdout: 
stderr: error: refs/pull-requests/66/from does not point to a valid object!
error: Could not read 7a99185626f667ab8c34d502417c47e99778e633
error: Could not read 7a99185626f667ab8c34d502417c47e99778e633
remote: error: Could not read 7a99185626f667ab8c34d502417c47e99778e633        
remote: fatal: revision walk setup failed        
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header

joerg.schwaerzler@infineon.com (JIRA)

unread,
Jul 8, 2019, 11:35:04 AM7/8/19
to jenkinsc...@googlegroups.com
Joerg Schwaerzler edited a comment on Bug JENKINS-45997
Not sure whether this is the same issue. But this is the closet ticket I could find.
For us Bitbucket + Branch Source plugin was working just find - until today. Now for one of our repositories I cannot convince Jenkins to clone the repository correctly ritght after a PR was updated or created.

Now we always would have to re-trigger each PR build manually in order to get it running. Once triggered automatically the builds won't work (see below).
Furthermore - *other, unrelated jobs* which are trying to clone the repository at the very same point in time when the PR is updated and which are not even trying to check out the pull request revision but master (of the same repository) - *happen to fail with the very same error messages*!


Not sure whether this would be an issue in Bitbucket or in Jenkins git plugin or Bitbucket branch source plugin. Maybe somebody can comment.

The error message is either:
{code}

Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --no-tags --progress https://******* +refs/pull-requests/66/from:refs/remotes/origin/PR-66" returned status code 128:
stdout:
stderr: fatal: Couldn't find remote ref refs/pull-requests/66/from
{code}


or something like (using a slightly different refspec):
{code}

git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* +refs/pull-requests/*/merge:refs/remotes/origin/PR-*" returned status code 128:
stdout:
stderr: error: refs/pull-requests/66/from does not point to a valid object!
error: Could not read 7a99185626f667ab8c34d502417c47e99778e633
error: Could not read 7a99185626f667ab8c34d502417c47e99778e633
remote: error: Could not read 7a99185626f667ab8c34d502417c47e99778e633        
remote: fatal: revision walk setup failed        
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header
{code}

Curiously the Jenkins can be cloned. However later when it comes to the `checkout scm` resp, git step it won't work.

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

unread,
Jul 8, 2019, 11:45:04 AM7/8/19
to jenkinsc...@googlegroups.com

Joerg Schwaerzler it is usually much less effective to request help by updating an existing closed bug report than to ask for help on the mailing lists or in the chat channels. There are far fewer people watching updates to Jenkins bug reports than watch the mailing lists and the chat channels.

In your case, the messages may indicate that a cache repository on the Jenkins master has been damaged or left in an inconsistent state. You may want to look in the $JENKINS_HOME/caches directory to find the directory which is used as the cache for that job. One technique I've used has been to:

$ cd $JENKINS_HOME/caches
$ for repo in *; do (cd $repo && echo ==== $repo && git remote -v | grep fetch); done

That will list the remote repository for each of those cache directories. Remove the directory for the remote repository that is having that problem. The next use of the cache will clone that repository and may be enough to resolve the issue.

Reply all
Reply to author
Forward
0 new messages