When is BITBUCKET_TAG environment variable set?

This question is in reference to Atlassian Documentation: Environment variables in Bitbucket Pipelines

I've been experimenting with pushing commits and tags on master and other branches and I can't find a situation when the BITBUCKET_TAG environment variable is set.

 Under what scenario is the BITBUCKET_TAG set and triggers a pipelines build?


1 answer

0 vote

Bitbucket Pipelines currently doesn't build pushed tags (it only builds the top commit of the push). 

Is there anything specific you are trying to achieve with Bitbucket tags?

I was prototyping how to migrate our deployment pipeline from Bamboo Cloud using tags as the trigger on specific branches.   (qa branch, tagging RELEASE-X, triggers deployment)


FYI - the documentation I reference in the original post documents a BITBUCKET_TAG environment variable kicks off a build!


BITBUCKET_TAGThe tag of a commit that kicked off the build. This value is only available on tags.

We are also attempting to use the BITBUCKET_TAG environment variable without success. Specifically, when a commit is pushed to master, we are using Pipelines to package our code and upload the archive file to Artifactory. The archive file needs to include the version number (i.e. the tag on master), but the BITBUCKET_TAG environment variable isn't being set.

On first read of Jeroen's answer he appears to suggest the env var BITBUCKET_TAG is pointless :)


I'm guessing you have to tag the commit locally prior to pushing the commit to the remote branch (Bitbucket). This would then kick off a build and have the tag available immediately.

Suggest an answer

Log in or Join to answer
Community showcase
Jason Wong
Published yesterday in Agility Beta

Welcome to agility

Every team in the world is unique, and so   Atlassian believes   that each and every team's best way of working  needs to  be molded to their unique circumstances  – ...

257 views 5 14
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