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

Bitbucket Server Integration webhook marks branches as deleted in a multibranch project that is not using this plugin

    •  2.1.1

      I set up two multibranch projects in the same Jenkins instance. Both of them refer to the same repository in Bitbucket Server, but one of them is using Bitbucket Branch Source Plugin and the other is using Bitbucket Server Integration. Each of them has its own webhook in Bitbucket Server. The "Bitbucket Server trigger scan after push" option is checked only in the multibranch project that uses Bitbucket Server Integration.

      Now when I push commits to the repository, the webhooks correctly trigger a build in each multibranch project. However, the build using Bitbucket Branch Source Plugin fails: the multibranch project somehow believes that the branch has been deleted, so it does not clone the repository at all. If I click "Scan Multibranch Pipeline Now", then Jenkins realizes that the branch exists, and immediately builds it; but the next push will again mark the branch as deleted.

      If I disable the webhook that has been set by Bitbucket Server Integration, and push again, then Jenkins understands that the branch exists, and further pushes do not change that. Therefore, it seems that the webhook handler in Bitbucket Server Integration is messing up the branch in the multibranch project that is using Bitbucket Branch Source Plugin.

          [JENKINS-63069] Bitbucket Server Integration webhook marks branches as deleted in a multibranch project that is not using this plugin

          Kalle Niemitalo added a comment - - edited

          Oh no! The Bitbucket Server Integration webhook handler was marking a branch as deleted even when I pushed commits to an entirely different (not a fork) repository in a different Bitbucket Server project, and the name of the branch (e.g. "master") matched. This was evident from the "Multibranch Pipeline Events" log in Jenkins.

          There are some projects that I cannot migrate from Bitbucket Branch Source Plugin to Bitbucket Server Integration before JENKINS-63033 is implemented, and I cannot require each repository to use distinct branch names, so I have now reverted all projects back to Bitbucket Branch Source Plugin, deleted the webhooks, and revoked the access token to prevent users from adding any more webhooks via the plugin.

          Kalle Niemitalo added a comment - - edited Oh no! The Bitbucket Server Integration webhook handler was marking a branch as deleted even when I pushed commits to an entirely different (not a fork) repository in a different Bitbucket Server project, and the name of the branch (e.g. "master") matched. This was evident from the "Multibranch Pipeline Events" log in Jenkins. There are some projects that I cannot migrate from Bitbucket Branch Source Plugin to Bitbucket Server Integration before JENKINS-63033 is implemented, and I cannot require each repository to use distinct branch names, so I have now reverted all projects back to Bitbucket Branch Source Plugin, deleted the webhooks, and revoked the access token to prevent users from adding any more webhooks via the plugin.

          Yup, we are having the same issue.

          Marcin Kwiecien added a comment - Yup, we are having the same issue.

          Kalle Niemitalo added a comment - I should test whether https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/pull/208 fixed this.

          Kalle Niemitalo added a comment - Fixed in Bitbucket Server Integration 2.1.1 by https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin/pull/208 .

            Unassigned Unassigned
            kon Kalle Niemitalo
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: