Issue
Bitbucket Pull Requests fail with "ERROR: Could not do lightweight checkout, falling back to heavyweight"
ERROR: Could not do lightweight checkout, falling back to heavyweight
java.io.FileNotFoundException: URL: /path/to/my/awesome/project/Jenkinsfile?at=pull-requests%2F59%2Fmerge&start=0&limit=500
at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:834)
at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getFileContent(BitbucketServerAPIClient.java:1129)
at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:98)
at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:335)
at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:107)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Environment
- CloudBees CI (CloudBees Core) on modern cloud platforms - Managed Master
- CloudBees CI (CloudBees Core) on traditional platforms - Client Master
- CloudBees Jenkins Enterprise - Managed Master
- CloudBees Jenkins Platform - Client Master
- CloudBees Jenkins Distribution
- Jenkins LTS
- Bitbucket Server >
7.0
- Bitbucket Branch Source plugin <
2.9.0
Resolution
This is a known issue with BitBucket 7.0 that was reported in JIRA [JENKINS-61493] Lightweight checkout fails in Bitbucket Server 7.0; refs/pull-requests/*/merge does not exist - Jenkins JIRA
Here is the relevent comment from the JIRA
The linked comment below indicates that in BitBucket 7 Atlassian has removed the ability to do lightweight checkout while using the “Merging” strategy. This is “intentional” and “by-design” behavior implemented by Atlassian. It is beyond the control of Jenkins project to fix this at this time. If your build fails while attempting to checkout, be sure you’ve enabled “Call changes API” for your Bitbucket 7 endpoints.
The solution is to enable the Call changes API
for your BitBucket server endpoint. This setting can be enabled per BitBucket server endpoint under Jenkins > Manage Jenkins > Bitbucket Endpoints:
Please note the Call changes API
setting was added in version 2.9.0
of the bitbucket-branch-source
plugin. You will need to upgrade the Bitbucket Branch Source plugin
to version 2.9.0
or higher. If you are a CloudBees customer, you may need to temporarily disable the CloudBees Assurance Program (CAP) in order to find the update as explained here: Plugins missing from Update Center after installing CloudBees Jenkins v2.x – CloudBees Support
0 Comments