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. buildlog.txt
          13 kB
        3. config.xml
          5 kB
        4. image-2021-11-24-10-25-16-734.png
          image-2021-11-24-10-25-16-734.png
          27 kB
        5. image-2021-11-24-10-32-49-900.png
          image-2021-11-24-10-32-49-900.png
          20 kB
        6. image-2021-11-24-10-39-47-808.png
          image-2021-11-24-10-39-47-808.png
          39 kB
        7. image-2021-11-24-10-55-43-189.png
          image-2021-11-24-10-55-43-189.png
          38 kB
        8. webhook-request.txt
          7 kB

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

          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 added a comment - - edited

          Hi,

          we have this issue in our environment:

          • Jenkins 2.289.1
          • Bitbucket Server integration Plugin 3.1.0
          • Bitbucket Server 7.6.2

           

          The configuration of the Bitbucket Server is:

          The job we are using is a Pipeline-job. I have attached the configuration

           

          In Bitbucket the Webhook is like this:

           

          I have also attached one of the build logs.

           

          In the example the Pull Request from accbsibranch5 to master triggered the build.

          But the build was done for branch accbsibranch1.

          I have also attached the webhook-Request  for this

           

          I think we can also provide the git repository of this test if it helps.

           

          Thanks

          Christoph

           

          Christoph added a comment - - edited Hi, we have this issue in our environment: Jenkins 2.289.1 Bitbucket Server integration Plugin 3.1.0 Bitbucket Server 7.6.2   The configuration of the Bitbucket Server is: The job we are using is a Pipeline-job. I have attached the configuration   In Bitbucket the Webhook is like this:   I have also attached one of the build logs.   In the example the Pull Request from accbsibranch5 to master triggered the build. But the build was done for branch accbsibranch1. I have also attached the webhook-Request  for this   I think we can also provide the git repository of this test if it helps.   Thanks Christoph  

          Hi Christoph, thanks for the reply.

          Yes a test repository would be extremely helpful!

          Martin Henschke added a comment - Hi Christoph, thanks for the reply. Yes a test repository would be extremely helpful!

          Christoph added a comment -

          Hi Martin, I am really sorry for the delayed answer, this got lost in the end of year madness.

          I have uploaded the repository now. But it is password protected.

          The data is not really critical, but as it is a public website I would prefer this.

          Is there a way I can send the password to you?

           

          Thanks Christoph

          Christoph added a comment - Hi Martin, I am really sorry for the delayed answer, this got lost in the end of year madness. I have uploaded the repository now. But it is password protected. The data is not really critical, but as it is a public website I would prefer this. Is there a way I can send the password to you?   Thanks Christoph

          Hi christopha,

          You can send a password to my email (details on my profile here in confluence). Alternatively, you could open a support case at getsupport.atlassian.com, and share your information there. Whichever works for you.

          Martin Henschke added a comment - Hi christopha , You can send a password to my email (details on my profile here in confluence). Alternatively, you could open a support case at getsupport.atlassian.com, and share your information there. Whichever works for you.

          Christoph added a comment -

          Hi Martin,

          I've sent now again the mail with the password. I guess the one I sent on February 4th didn't work.

          Thank you Christoph

          Christoph added a comment - Hi Martin, I've sent now again the mail with the password. I guess the one I sent on February 4th didn't work. Thank you Christoph

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

              Created:
              Updated: