Create
cancel
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

If I want extra steps to run on master, do I have to define the default steps twice?

I see in the Bitbucket pipelines documentation that I can specify steps to run just on master, i.e.

branches:

    master:

 

I want the steps in default: to run as well as the specific ones for master:

- Do I need to define those twice?

i.e. Do I need to do this, or is there a more efficient way?

 



pipelines:
default:
- step:
name: Step one
script:
- echo Step One Is Identical Both Times
branches:
master:
- step:
name: Step one
script:
- echo Step One Is Identical Both Times
- step:
name: Step two
script:
- echo Step two

1 answer

1 accepted

0 votes
Answer accepted

Hi @Chris Doman ,

You can use YAML anchors for repeated sections, to make the file easier to read and also update:

E.g. the example you included would look like this with anchors:

definitions:
steps:
- step: &step-one
name: Step one
script:
- echo Step One Is Identical Both Times

pipelines:
default:
- step: *step-one
branches:
master:
- step: *step-one
- step:
name: Step two
script:
- echo Step two

Is this something that works for you? Please feel free to let me know if you have any questions.

Kind regards,
Theodora

Thats great - Thankyou Theodora

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

🎨 Add some visual life to your templates

Hi Atlassian Community, My name is Avni Barman, and I am a Product Manager on the Confluence Cloud team. Based on feedback from you, we are giving admins more power to create templates that a...

197 views 3 8
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