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

Latest version of bitbucket pull request builder plugin checks out wrong commit on PRs

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • Jenkins 2.332.1
      Git Plugin 4.10.3
      BitBucket Pull Request Builder Plugin 1.5.0

      In testing upgrading the Jenkins core and plugins I've encountered this twice; last time was about a year ago and I was able to resolve it by reverting the git plugin to 4.3.0 and Bitbucket pullrequest builder plugin to 1.4.28

      When jobs are triggered with the Bitbucket Pullrequest Builder Plugin, the git clone uses the latest commit on the target branch, not the HEAD of the dev branch being tested. That commit is visible in the console output but it reports an error stating the commit is from a different repo:

      The pull request:

      And the git info summary on the CI job lists the target branch, not the source branch, as is the case with pre-upgrade jobs:

       

      I confirmed same results with pipeline and freestyle jobs.

          [JENKINS-68124] Latest version of bitbucket pull request builder plugin checks out wrong commit on PRs

          Mark Waite added a comment -

          Some workarounds that you might consider could include:

          • Preserve the second fetch from the git plugin using the global settings. I don't think that behavior is related to the optimization that avoids performing two fetches of every repository, but it is a low cost option for an experiment
          • Switch from pull request builder to use a multibranch pipeline instead. Multibranch pipelines will automatically manage the branch creation and deletion and may be more actively maintained than the Bitbucket pull request builder

          I would suspect some change in the data sent by Bitbucket, but am certainly not confident of that.

          Mark Waite added a comment - Some workarounds that you might consider could include: Preserve the second fetch from the git plugin using the global settings . I don't think that behavior is related to the optimization that avoids performing two fetches of every repository, but it is a low cost option for an experiment Switch from pull request builder to use a multibranch pipeline instead. Multibranch pipelines will automatically manage the branch creation and deletion and may be more actively maintained than the Bitbucket pull request builder I would suspect some change in the data sent by Bitbucket, but am certainly not confident of that.

          Thanks Mark, I was able to confirm that with both plugins upgraded and the second fetch enabled did not fix it, and a downgrade of the Bitbucket pullrequest builder plugin alone (to 1.4.28) did (second fetch disabled, the default). So it's not the git plugin at least.

          Unfortunately multibranch pipeline won't work in this case as our PR testing needs to be independent from branch creation for our workflow.

          Caty Kratzmann added a comment - Thanks Mark, I was able to confirm that with both plugins upgraded and the second fetch enabled did  not fix it, and a downgrade of the Bitbucket pullrequest builder plugin alone (to 1.4.28) did (second fetch disabled, the default). So it's not the git plugin at least. Unfortunately multibranch pipeline won't work in this case as our PR testing needs to be independent from branch creation for our workflow.

            Unassigned Unassigned
            ckratzmann Caty Kratzmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: