Here's an example:
image: node:5.11.0 pipelines: default: - step: script: - echo "This script runs on all branches that don't have any specific pipeline assigned in 'branches'." branches: master: - step: script: - echo "This script runs only on commit to the master branch." feature/*: - step: image: openjdk:8 # This step uses its own image script: - echo "This script runs only on commit to branches with names that match the feature/* pattern."
That example shows two branches based on the master branch:
- a branch called feature/BB-123-fix-links that is a feature branch
- a branch called experimental where your team can go crazy innovating and breaking stuff. This branch is not a feature branch.
The same bitbucket-pipelines.yml file lives in the root directory of each branch. On each commit to a branch, Pipelines executes the scripts assigned to the branch in the bitbucket-pipelines.yml file:
- master contains build instructions that are executed on a commit to master
- feature/* contains build instructions that are executed on a commit to any feature branch (that's our BB-123-fix-links branch)
- default contains build instructions that are executed on a commit to any branch that is not master or feature (that's our experimental branch)
Note that the branch builds are triggered only if the bitbucket-pipelines.yml file requirements for a branch are met.