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?


2 answers

This widget could not be displayed.

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.

I am facing issue with BITBUCKET_TAG, when I am trying to scan my tag branch using blackduck software it will show "missing argument" issue.Some one please help me.

Hi @Aruljothi J,

might be best to create a seperate question for this, since it is a different topic. 

Regarding your question, I am not entirely sure what blackduck software does, but keep in mind that the $BITBUCKET_TAG variable will only be set if you pushed a tag (i.e. not if you pushed a branch reference). 

This widget could not be displayed.

Screen Shot 2018-05-31 at 1.15.37 PM.pngThanks for your response Jeroen.

I would like to elaborate my issue here.

#Blackduck is opensource security scan software, when I run my pipeline with "analyze-with-blackduck" it will scan my branches(master/develop/future) and create/send report to blackduck server.

"analyze-with-blackduck"-this is the command which I am using for my branch scanning.

It will scan for master/develop/future branches not for TAGS.

We had a shell script to detect and scan the branches not for tags, now I am trying to scan Tags also but it's shows error.

I have updated my pipeline.yml and script:

image: :my-java-image-v1



   release_*:  #this is using for each new release.."*" is the issue.

     - step:


           - maven


      - mvn -B clean install -Dmaven.test.skip

     - analyze-with-blackduck . #This is a cmd for blackduck scanner

 Below pipeline is using for develop, it's working 




     - step:


           - maven


      - mvn -B clean install -Dmaven.test.skip

     - analyze-with-blackduck . #This is a cmd for blackduck scanner

#We mentioned scan information on docker image.




$BITBUCKET_TAG=${BITBUCKET_TAG:-$1} #not working


echo "TAG"

This is similar with @Justin Judd query.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in Statuspage

What are your best incident management tips and stories? #HugOps

 👋Community members! Downtime happens. And great incident response takes a village. Teams like Support, Dev, SRE, Ops, IT, and Marketing have to come together to resolve the problem while keep...

70 views 2 3
Join discussion

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