Atlassian Bitbucket Integration plugin triggers builds for multiple branches

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Issue symptoms:

A push to Bitbucket triggers builds for multiple branches, not only the branch that has received the most recent push.

Explanation:

Official Atlassian Jenkins integration plugin checks Bitbucket Server for any changes in a repository with a configured webhook to Jenkins since the last build was triggered. If a change is found - it builds all the branches that have changed.

Let’s consider a situation:

Situation 1:

  1. A user pushes a commit to branch FEAT-1.1.1.

  2. An Auto-merging feature is enabled propagating the changes to FEAT-1.1 and Release branches.

Result:

Jenkins builds branches FEAT-1.1.1, FEAT-1.1, and Release.

Situation 2:

  1. Jenkins instance is brought down for maintenance.

  2. A user pushes changes to branches FEAT-1.1, FEAT-2.0, and BUGFIX-456.

  3. Jenkins instance is brought back up.

  4. A user pushes changes to branch FEAT-2.0.

Result:

Branches FEAT-1.1, BUGFIX-456, and FEAT-2.0 (the most recent commit) will be built in Jenkins.

Once the push to FEAT-2.0 happens and communication between Bitbucket Server and Jenkins is up and running again, the Jenkins plugin will scan the whole repository in Bitbucket Server for changes since the last scan. It should discover updates to not only the most recently updated branch but also all the others not built yet.

If your intention is to build a specific branch, feel free to use Branch Specifier in 'Branches to build' in Jenkins build configuration:

(Auto-migrated image: description temporarily unavailable)
Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.