Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

trigger pipeline based on tag on branch

Is there any way to trigger a pipeline based on a tag on a branch?

currently I'm using :

 

pipelines:
default:
- step: *build-package
- step: *generate-docs

tags
:
v*.*.*:
- step: *build-package
- step: *generate-docs
- step: *publish-docs
but I would like the default to only apply to dev branches (exclude master) and then master branch to only build when a tag is applied. 

3 answers

1 accepted

0 votes
Answer accepted

To answer my own question, a couple links online suggest that bitbucket does not let you exclude branches so I need to create a dummy branch trigger for master. I haven't had a chance to push anything to master so this is untested but I think it should only trigger a build on master when a tag is pushed. :fingers-crossed:

 

pipelines:
branches:
'**':
- step: *build-package
- step: *generate-docs
'master':
- step:
script:
- echo "nothing to do for master branch"
tags:
v*.*.*:
- step: *build-package
- step: *generate-docs
- step: *publish-docs

I need this too, because when pushing tags for the staging branch, it does into the pipeline as "production too".

 

I used Bitrise before, and pipeline on a tag on a specific branch was totally possible. And I need commits to master with tags to trigger the pipeline. But only for master. To staging branch the steps are different.

0 votes
Riley Venable (Atlas Bench)
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 16, 2023

Yes, you can trigger a pipeline based on a tag on a branch using the "Tags start condition" option in the bitbucket-pipelines.yml file.

can you provide anexample?

pipelines:
branches:
'**':
- step: *build-package
- step: *generate-docs
'master':
tags:
v*.*.*:
- step: *build-package
- step: *generate-docs
- step: *publish-docs

i tried something like this but I don't think you can nest tags under a branch. I really need to specify all branches except master for the first part and then have a separate tags section that applies to any branch 

Like Tommo likes this

Would this make sense to exclude master except when tags are pushed to master?

pipelines:
branches:
'[!master]**':
- step: *build-package
- step: *generate-docs

tags:
v*.*.*:
- step: *build-package
- step: *generate-docs
- step: *publish-docs

 

Like Tommo likes this

An example would be nice, because I need to only trigger the pipeline when on master branch and with tags "*.*.*"

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events