[JIRA] (JENKINS-61493) Lightweight checkout fails in Bitbucket Server 7.0; refs/pull-requests/*/from does not exist

2 views
Skip to first unread message

Kalle.Niemitalo@procomp.fi (JIRA)

unread,
Mar 16, 2020, 8:04:02 AM3/16/20
to jenkinsc...@googlegroups.com
Kalle Niemitalo created an issue
 
Jenkins / Improvement JENKINS-61493
Lightweight checkout fails in Bitbucket Server 7.0; refs/pull-requests/*/from does not exist
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: bitbucket-branch-source-plugin
Created: 2020-03-16 12:03
Priority: Minor Minor
Reporter: Kalle Niemitalo

After upgrading to Bitbucket Server 7.0.1, we get this kind of error for every pull request in multibranch projects in which Jenkins has been configured to build the result of merging the pull request:

 ERROR: Could not do lightweight checkout, falling back to heavyweight
 java.io.FileNotFoundException: URL: /rest/api/1.0/projects/SISU/repos/rahti-hybrid/browse/Jenkinsfile?at=pull-requests%2F771%2Fmerge&start=0&limit=500
 	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:831)
 	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getFileContent(BitbucketServerAPIClient.java:1123)
 	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:303)
 	at hudson.model.ResourceController.execute(ResourceController.java:97)
 	at hudson.model.Executor.run(Executor.java:427)

git ls-remote origin shows that Bitbucket Server now publishes "refs/pull-requests/771/from" but not "refs/pull-requests/771/merge", even though the pull request has no merge conflicts (the target branch even has no new commits). This might be related to "the switch from a 3-way diff to a 2-way diff in pull requests" in Bitbucket Server 7.0.0.

Jenkins then does the heavyweight checkout and successfully merges the pull request, so the project ultimately builds OK, but the heavyweight checkout consumes a lot of time and disk space.

I don't know whether there is any simple way to fix this in the bitbucket-branch-source plugin. If Bitbucket Server has deliberately ceased publishing "refs/pull-requests/*/merge", perhaps the plugin could do a three-way merge on Jenkinsfile only, rather than on the entire tree. That would require a REST API for getting the commit ID of a merge base though, and I don't know whether such a thing exists.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages