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

Provide lightweight checkouts for Bitbucket Pull Requests

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • Jenkins 2.98
      Bitbucket Branch Source Plugin v 2.2.8
    • v2.4.3

      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.

          [JENKINS-48737] Provide lightweight checkouts for Bitbucket Pull Requests

          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

          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

          Roman Bolshakov added a comment - - edited

          Lightweight checkouts might help to work-around JENKINS-45997

          Roman Bolshakov added a comment - - edited Lightweight checkouts might help to work-around  JENKINS-45997

          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.

          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.

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

          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

          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

          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

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

              Created:
              Updated:
              Resolved: