Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Some branches have shared steps & first step cannot be manual

I have the following deployments:

  • Test
  • Security
  • Staging
  • Production

I have steps associated with each deployment.  Each deployment has deployment variables associated with it.

I would like to run the "Test" & "Security" steps on all branches.  I would like the "develop" branch to run the steps for "Test", "Security" & "Staging".  I would like the "master" branch to run the steps for "Test", "Security", "Staging", and "Production".  Any other branches like "feature/*" only run steps for "Test" & "Security".  

The "Production" steps have a manual trigger.

I tried doing a combination of default: and branches:, but it looks like default: only runs on NON-MATCHED branches.  


Any suggestions will be greatly appreciated.


1 answer

0 votes

Hi @Monica Gordillo ,

Since you want to reuse the same steps for different branches, I would suggest using YAML anchors to define these steps.

You can check the following doc for more information on YAML anchors:

Based on the description of your deployments and also which deployments you want to run for a specific branch, I believe you could structure your bitbucket-pipelines.yml file as follows:

- step: &test
name: Test
deployment: Test
- echo "Test deployment"
- step: &security
name: Security
deployment: Security
- echo "Security deployment"
- step: &staging
name: Staging
deployment: Staging
- echo "Staging deployment"
- step: &production
name: Production
deployment: Production
trigger: manual
- echo "Production deployment"

- step: *test
- step: *security
- step: *test
- step: *security
- step: *staging
- step: *test
- step: *security
- step: *staging
- step: *production

The section with the keyword definitions defines each deployment step as an anchor, so you can reuse it later.
Then, the pipelines section defines which steps to run depending on the branch.

Is this something that works for you?

Kind regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

123 views 2 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you