Configure Bitbucket Cloud pipeline branch based triggers outside of the 'bitbucket-pipelines.yml' file
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
Currently, you may use the branches property in your YAML configuration for branch-based triggers in Bitbucket Cloud pipelines. The default pipeline definition contains instructions that run on a commit to any branch, or a glob pattern can be used to match branches.
This article describes a Premium feature that allows you to configure branch triggers outside of your YAML configuration, giving you additional control over your deployments.
Environment
Bitbucket Cloud Pipelines
Solution
The premium feature, deployment permissions has an option called Branches allowed to deploy to <branch> which allows you to configure branch triggers outside of your YAML configuration:
The master branch is allowed to deploy to the test environment, and the default branch is set in the pipeline step.
1
2
3
4
5
6
pipelines:
default:
- step:
deployment:
script:
- echo "test"
When changes are pushed to any branch other than the master, for example, the "glob" branch, the pipeline build will be triggered, but the build will be paused since the triggered branch is not allowed under deployments. A message is shown: "Paused This pipeline was paused because Test can not be deployed to from the glob branch."
This is one method for achieving Bitbucket Cloud pipeline branch-based triggers outside of your YAML configuration.
Bitbucket Pipelines requires the deployments to be ordered as follows in the bitbucket-pipelines.yml file: Test environments > Staging environments > Production environments
Deployment permissions are part of our Bitbucket Cloud Premium subscription, focused on features for teams that require admin controls, security, and auditing capabilities.
Was this helpful?