Jenkins fails to checkout pull requests from Bitbucket 7.1.x

As of April, 30, 2020, the workaround for this issue is to install a custom build of the Bitbucket Branch Source plugin

Error in Jenkins logs may look like this:

13:44:13 ERROR: Could not do lightweight checkout, falling back to heavyweight 13:44:13 java.io.FileNotFoundException: URL: /rest/api/1.0/projects/RTS/repos/rts-test/browse/Jenkinsfile?at=pull-requests%2F1%2Fmerge&start=0&limit=500 13:44:13 at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:831) 13:44:13 at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getFileContent(BitbucketServerAPIClient.java:1123) 13:44:13 at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:98) 13:44:13 at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:335) 13:44:13 at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:107) 13:44:13 at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309) 13:44:13 at hudson.model.ResourceController.execute(ResourceController.java:97) 13:44:13 at hudson.model.Executor.run(Executor.java:428)

The error occurs because of changes in Bitbucket 7.1 which are not properly supported by Bitbucket Branch Source plugin.

As of April 30, 2020, a workaround is to install a custom build of the Bitbucket Branch Source plugin mentioned here:

https://issues.jenkins-ci.org/browse/JENKINS-61493?focusedCommentId=388268&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-388268

Â