Required builds rules can be added for branch matchers, which include a specific branch name, or a pattern, or a branching model. The branching model selection includes branch model categories (e.g. feature branch prefix) and branch model branches (e.g. development branch) that are enabled for the project or repository.
Required build rules created with model branch matchers (development branch and production branch) do not work (i.e. no merge check is done for a protected target branch matching a model branch, and no exemption is made for an exempt source branch matching a model branch). All other matchers function correctly, including model category matchers (bugfix, feature, hotfix, release).
This is reproducible on Data Center: yes
- Turn on the development branch and/or production branch matcher branch model in the repository settings (the development branch is on by default).
- Create a required build rule with a model branch matcher (e.g. protect the branching model "Development branch" or "Production branch", or adding an exemption for the branching model "Development branch" or "Production branch")
- Create a pull request that satisfies the required build rule (e.g. a pull request from or targeting the "Development branch" or "Production branch")
For a required build rule protecting the development or production branch, a pull request targeting that branch is prevented from being merged until a successful build execution for the rule is present.
For a required build rule exempting the development or production branch, a pull request from that branch should not be prevented from being merged for that rule.
Required build rules with model branch matchers do not function.
Required builds rules with model branch matchers created after upgrading to a version of Bitbucket that includes the bugfix (see fixed versions) will function correctly. Additionally, upgrading to Bitbucket 8.5.0+ will include a database migration that automatically fixes any broken model branch matchers.
On versions of Bitbucket with the bugfix but before 8.5.0, required build rules with model branch matchers created before upgrading will show up as "INVALID" in the required build rules list after upgrade. These can be fixed by editing the rule, re-selecting the appropriate matcher and saving.
There is no workaround for using a model branch matcher in a required build rule for versions of Bitbucket that do not include the fix. A branch name matcher could be used instead to give similar functionality.