How to trigger pipeline by several tags?

Michael_Gustus April 2, 2020

I have several tags in git that should trigger the same bitbucket pipeline. There is no common pattern for these tags. So I need something like this:

tags:
one,two,three:
- step:
name: "deploy"
services:
- docker
script:
...

 

For tags 'one', 'two' or 'three' I need to run this pipeline, but not for other tags.

How can I achieve this?

Thanks!

1 answer

1 accepted

0 votes
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 2, 2020

Hello @Michael_Gustus ,

Welcome to the Community!

Each item under tags declares only one tag. You need to make use of YAML anchors and aliases to reuse common parts of your configuration. In your case the configuration would look something like this:

tags:
one
: &tag-build
- step:
name: "deploy"
services:
- docker
script:
...
two: *tag-build
three: *tag-build

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

Michael_Gustus April 4, 2020

I guess this will do the trick :)
Thank you!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events