When pre merge check fails build status is not posted to Bitbucket

XMLWordPrintable

      This is related to JENKINS-76379.

      There might be useful information in the above issue as I go into more detail as to the relevant code.

      Note I am unable to test on the latest 5.0.0 version of the plugin but looking at the release notes, I do not see any indication that this has been fixed.

      When running a PR job in Jenkins a Pre merge check gets ran to confirm that a branch is mergeable. This causes the checkout to fail if the branch is not able to be merged. This is the expected behavior according to the PreBuildMerge trait.

      Unfortunately, since build statuses are posted back to Bitbucket when a checkout is completed/successful this can make it look like a build never ran in Jenkins since the checkout fails before a status can be sent. 

      Steps to reproduce

      1. Create a Multibranch Pipeline Job
      2. Enable the Pull Request discovery trait

      3. Create a Pull Request on Bitbucket Server

      4. Make it so your PR is unmergeable (merge conflict etc).

      5. Run your PR Job through Jenkins

      6. Notice that the checkout fails and no build status is pushed back to the open Bitbucket PR.

      Current Behavior: Unmergeable branches don't get build statuses posted back to Bitbucket
      Desired Behavior: A failed build status is posted back to Bitbucket.

            Assignee:
            Unassigned
            Reporter:
            Aidan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: