Limit pipelines to a specific branch

This question is in reference to Atlassian Documentation: Configure bitbucket-pipelines.yml

Is there a way to disable pipelines for specific branches?  Or, only enable for one specific branch?  We'd like to only have pipelines run on our 'master' branch for now, and ignore everything else.  

Tried adding a default that simply has an echo statement in the script, but it still spends a lot of time spinning up a docker, just to do that echo.  Seems like a waste of resources?

1 answer

1 accepted

5 votes
Joshua Tjhin Atlassian Team Jun 07, 2016

Hi James

You sure can limit pipelines to run only when certain branches change.

Here's an example of a bitbucket-pipelines.yml that only runs when master is pushed

      - step:
            - echo "only on master"

With this configuration, if I push another branch, it won't be built.

That seems to have done the trick.  I was thinking 'default' was a required block, meaning a branch always has a match.  I was wrong!  

Thank you.

Yup, works for me too, thanks!

Note that the 'default' block is a sibling of the 'branches' block, not a descendant.  That tripped me up for a couple minutes.

I have a single repository under bit-bucket account and this repository has this 4 branches :

- master 
- Admin - Web

 I put bitbucket-pipelines.yml under master and its like that:


image: maven:3.5.0-jdk-7
API: - step:
: - maven script: - mvn install


so I expect that when I push something to API, this will file will be triggered , but in fact it never happened, did I miss any?

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,278 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot