Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-48737

Provide lightweight checkouts for Bitbucket Pull Requests

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      v2.4.3

      Description

      Currently when trying to do a Pull Request build using the Bitbucket Branch Source Plugin, it falls back to do a heavyweight checkout for both building the PR head revision and also the PR merged revision.

       

      ERROR: Could not do lightweight checkout, falling back to heavyweight
      java.io.FileNotFoundException: URL: /rest/api/1.0/projects/someproject/repos/somerepo/browse/jenkins.pipeline?at=PR-1184&start=0&limit=500
      	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:523)
      	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getFileContent(BitbucketServerAPIClient.java:730)
      	at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:81)
      	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:262)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)

       

      The URL parameter for the branch is "at=PR-1184", but should be:

      • For building the PR head revision: "refs/pull-requests/1184/from"
      • For building the PR merged revision: "refs/pull-requests/1184/merge"

      In both cases "refs/" can be omitted.

        Attachments

          Issue Links

            Activity

            Hide
            casz Joseph Petersen (old) added a comment -

            Merged #174 which adds support for lightweight checkout though only for bitbucket server.

            Bitbucket cloud is only partially covered by PR head revisions on the same owner & repository.
            See https://bitbucket.org/site/master/issues/5814/refify-pull-requests-by-making-them-a-ref

            Show
            casz Joseph Petersen (old) added a comment - Merged #174 which adds support for lightweight checkout though only for bitbucket server. Bitbucket cloud is only partially covered by PR head revisions on the same owner & repository. See https://bitbucket.org/site/master/issues/5814/refify-pull-requests-by-making-them-a-ref
            Hide
            casz Joseph Petersen (old) added a comment -

            I do not know of a way to use the Bitbucket Cloud API to get the proper merge strategy for the Jenkinsfile

            Show
            casz Joseph Petersen (old) added a comment - I do not know of a way to use the Bitbucket Cloud API to get the proper merge strategy for the Jenkinsfile
            Hide
            vollmilch Benjamin Fuchs added a comment - - edited

            Hi, we are also having this issue with our Bitbucket server.

            I created an easy fix for this issue:
            https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/117

            Also think that this is related to https://issues.jenkins-ci.org/browse/JENKINS-47617 since if the branch name would be the source branch and not something like PR-XXXX it would work without this fix.

            Show
            vollmilch Benjamin Fuchs added a comment - - edited Hi, we are also having this issue with our Bitbucket server. I created an easy fix for this issue: https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/117 Also think that this is related to https://issues.jenkins-ci.org/browse/JENKINS-47617 since if the branch name would be the source branch and not something like PR-XXXX it would work without this fix.
            Hide
            roolebo Roman Bolshakov added a comment - - edited

            Lightweight checkouts might help to work-around JENKINS-45997

            Show
            roolebo Roman Bolshakov added a comment - - edited Lightweight checkouts might help to work-around  JENKINS-45997
            Hide
            bjornmagnusson Björn Magnusson added a comment -

            Experiencing the same issue. And, as we use an mirrored solution where the Bitbucket master is far away the clone takes forever and times out.

            Environment:

            Jenkins 2.60.3
            Bitbucket Branch Source Plugin v2.2.8

            Show
            bjornmagnusson Björn Magnusson added a comment - Experiencing the same issue. And, as we use an mirrored solution where the Bitbucket master is far away the clone takes forever and times out. Environment: Jenkins 2.60.3 Bitbucket Branch Source Plugin v2.2.8

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              pixman20 pixman20
              Votes:
              14 Vote for this issue
              Watchers:
              21 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: