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

Bitbucket Integration plugin triggers builds for wrong branches while set to work with PR triggers only

      Bitbucket Server integration plugin set to trigger on Pull Request events only is supposed to run builds for branches for which specific PR event applies. However, it builds all the new commits for all the branches, not only for those with PR opened.

      Let's consider a situation:

      1. A build plan in Jenkins using Bitbucket Server integration plugin set to trigger on Pull Request events only
      2. We have 4 branches in a repo: master, FEAT-1, FEAT-2, FEAT-3.
      3. We have one open PR: FEAT-3 -> master.
      4. We push a new commit to FEAT-1 - the build doesn't start
      5. We push a new commit to FEAT-2 - the build doesn't start
      6. We push a new commit to FEAT-3 - the build starts first for FEAT-1, then FEAT-2, and after that starts for FEAT-3
        All the builds happen for the head commits of each branch.

      Tested on:
      Bitbucket 7.15
      Bitbucket Server Integration 3.1

        1. bb_server_int_tst1_repo.zip
          37 kB
        2. image-2021-11-24-10-55-43-189.png
          image-2021-11-24-10-55-43-189.png
          38 kB
        3. webhook-request.txt
          7 kB
        4. buildlog.txt
          13 kB
        5. image-2021-11-24-10-39-47-808.png
          image-2021-11-24-10-39-47-808.png
          39 kB
        6. image-2021-11-24-10-32-49-900.png
          image-2021-11-24-10-32-49-900.png
          20 kB
        7. config.xml
          5 kB
        8. image-2021-11-24-10-25-16-734.png
          image-2021-11-24-10-25-16-734.png
          27 kB

          [JENKINS-67151] Bitbucket Integration plugin triggers builds for wrong branches while set to work with PR triggers only

          Tomasz created issue -
          Atlassian Bitbucket Server made changes -
          Labels New: triaged

          Hi Tomasz, thanks for raising the ticket

          We've run this test with a few variations, but in no cases were we able to replicate the behaviour:

          • Created two branches off of master, pushed commits to both, opened a PR, then pushed to the source branch (only the source branch was built)
          • Tried with both the branch being present in Jenkins and absent
          • Tried a `git push --all` so the commits were pushed up together

          I'm wondering if this is a config issue. Can you share the job configuration xml, and if there's nothing sensitive, the build logs and jenkins logs?

          Martin Henschke added a comment - Hi Tomasz, thanks for raising the ticket We've run this test with a few variations, but in no cases were we able to replicate the behaviour: Created two branches off of master, pushed commits to both, opened a PR, then pushed to the source branch (only the source branch was built) Tried with both the branch being present in Jenkins and absent Tried a `git push --all` so the commits were pushed up together I'm wondering if this is a config issue. Can you share the job configuration xml, and if there's nothing sensitive, the build logs and jenkins logs?
          Christoph made changes -
          Attachment New: image-2021-11-24-10-25-16-734.png [ 56831 ]
          Christoph made changes -
          Attachment New: config.xml [ 56832 ]
          Christoph made changes -
          Attachment New: image-2021-11-24-10-32-49-900.png [ 56833 ]
          Christoph made changes -
          Attachment New: image-2021-11-24-10-33-50-170.png [ 56834 ]
          Christoph made changes -
          Attachment New: image-2021-11-24-10-39-47-808.png [ 56835 ]
          Christoph made changes -
          Attachment New: buildlog.txt [ 56836 ]
          Christoph made changes -
          Attachment New: webhook-request.txt [ 56837 ]

            Unassigned Unassigned
            ttokarczuk Tomasz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: