question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pull-Requests no longer working on BitBucket Server 7.0

See original GitHub issue

Your checklist for this issue

  • Jenkins version: 2.204.5

  • Plugin version: 2.7.0

  • Bitbucket cloud

  • Bitbucket server and version: 7.0.0, 7.0.1

Description

This plugin is no longer able to fetch and build pull-requests. Looks like thay changed the api without writing a note.

06:01:26  Started by user XXX YYY
06:01:26  Running as XXX YYY
06:01:34  ERROR: Could not do lightweight checkout, falling back to heavyweight
06:01:34  java.io.FileNotFoundException: URL: /rest/api/1.0/projects/proj/repos/repo/browse/Jenkinsfile?at=pull-requests%2F580%2Fmerge&start=0&limit=500
06:01:34  	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:831)
06:01:34  	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getFileContent(BitbucketServerAPIClient.java:1123)
06:01:34  	at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:98)
06:01:34  	at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:335)
06:01:34  	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:107)
06:01:34  	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:299)
06:01:34  	at hudson.model.ResourceController.execute(ResourceController.java:97)
06:01:34  	at hudson.model.Executor.run(Executor.java:427)
06:01:34  Checking out git https://xxx.yyyy.de/scm/proj/repo.git https://xxx.yyyy.de/scm/proj/repo.git into /var/jenkins_home/workspace/proj_repo_PR-580@script to read Jenkinsfile
06:01:34  using credential a63b7cb8-6690-4c0b-81b8-93969a0fabac
06:01:35  using credential a63b7cb8-6690-4c0b-81b8-93969a0fabac
06:01:35   > git rev-parse --is-inside-work-tree # timeout=10
06:01:35  Fetching changes from 2 remote Git repositories
06:01:35   > git config remote.origin.url https://xxx.yyyy.de/scm/proj/repo.git # timeout=10
06:01:35  Cleaning workspace
06:01:35   > git rev-parse --verify HEAD # timeout=10
06:01:35  No valid HEAD. Skipping the resetting
06:01:35   > git clean -ffdx # timeout=10
06:01:35  Pruning obsolete local branches
06:01:35  Fetching upstream changes from https://xxx.yyyy.de/scm/proj/repo.git
06:01:35   > git --version # timeout=10
06:01:35  using GIT_ASKPASS to set credentials 
06:01:35   > git fetch --tags --force --progress --prune -- https://xxx.yyyy.de/scm/proj/repo.git +refs/pull-requests/580/from:refs/remotes/origin/PR-580 # timeout=10
06:01:35  ERROR: Error fetching remote repo 'origin'
06:01:35  hudson.plugins.git.GitException: Failed to fetch from https://xxx.yyyy.de/scm/proj/repo.git
06:01:35  	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:909)
06:01:35  	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1131)
06:01:35  	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1167)
06:01:35  	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
06:01:35  	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:155)
06:01:35  	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:142)
06:01:35  	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:299)
06:01:35  	at hudson.model.ResourceController.execute(ResourceController.java:97)
06:01:35  	at hudson.model.Executor.run(Executor.java:427)
06:01:35  Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --force --progress --prune -- https://xxx.yyyy.de/scm/proj/repo.git +refs/pull-requests/580/from:refs/remotes/origin/PR-580" returned status code 128:
06:01:35  stdout: 
06:01:35  stderr: fatal: Couldn't find remote ref refs/pull-requests/580/from
06:01:35  
06:01:35  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2430)
06:01:35  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2044)
06:01:35  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:81)
06:01:35  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:569)
06:01:35  	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:907)
06:01:35  	... 8 more
06:01:35  ERROR: Error fetching remote repo 'origin'
06:01:35  [Bitbucket] Notifying pull request build result
06:01:36  [Bitbucket] Build result notified
06:01:36  ERROR: Maximum checkout retry attempts reached, aborting
06:01:36  Finished: FAILURE

https://community.atlassian.com/t5/Bitbucket-questions/Bitbucket-Server-7-0-PR-fetch-from-not-working/qaq-p/1320053

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:101 (49 by maintainers)

github_iconTop GitHub Comments

4reactions
viceicecommented, May 8, 2020

lightweight checkout is no longer possible with bitbucket server v7 and merge build strategy, because bitbucket no longer computes a merge commit.

2reactions
mattiassluiscommented, May 8, 2020

@joaoportela actually that makes perfect sense if you didn’t push any new changes in between. The “Call changes API” only needs to be called once to ensure the refs are created on Bitbucket. This is also what happens if you view the diff in the Bitbucket UI. Once the refs are created the plugin can do its thing (with the heavyweight checkout). What the “Call changes API” does is ensure that Bitbucket for sure created the refs (because with Bitbucket 7 they are only created on demand).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bitbucket Server 7.0 PR fetch from not working
We are facing the problem with the latest Bitbucket v7.4.0. Our CI system can not find remote references of our pull requests. $...
Read more >
Could not do lightweight checkout, falling back to heavyweight
Bitbucket Pull Requests fail with "ERROR: Could not do lightweight checkout, falling back to heavyweight"
Read more >
What's new this May? - Eficode
2-way diff for pull requests. Source Bitbucket Server 7.0 release notes. ... Pull requests will no longer visualize conflicts.
Read more >
Lightweight checkout fails in Bitbucket Server 7.0 - Jenkins Jira
Bug - A problem which impairs or prevents the functions of the product. JENKINS-49353 ERROR: Could not do lightweight checkout, falling back to ......
Read more >
Bitbucket Server + Jenkins Pull Request Decoration
Software: SonarQube version 9.2.4 (build 50792) Developer Edition, running in Centos 7 VM Jenkins 2.319.1 LTS Bitbucket Branch Source plugin ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found