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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Pipelines include tag when pushing to master?

Is it possible to build a `bitbucket-pipelines.yml` script that appends a tag when pushing to the master branch? I know I can do this when specifically pushing to a tag via the BITBUCKET_TAG environment variable. My current script has this...

      - step:
            - composer install
            - composer run-script build
            - zip -FSr uc-foi-database-${BITBUCKET_TAG}.zip ./ -x@exclude.lst #${BITBUCKET_TAG} is a default BB variable.
            - curl -u ${BB_AUTH_STRING} -X POST "${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"uc-foi-database-${BITBUCKET_TAG}.zip"

However, this results in `` and I'd like ``


2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Matt Ryall Atlassian Team Mar 27, 2017

If your commits are already tagged through some other process, you can use git describe to find the most recent tag on the current branch and use that in your script. You can grab it into an environment variable like this:

      - step:
            - ...
            - export GIT_TAG=`git describe`
            - zip -FSr uc-foi-database-${GIT_TAG}.zip ./ -x@exclude.lst
            - ...

If you want to be sure that the tag is on the exact commit running in your pipeline, you could use git describe --exact-match.

@Matt Ryall This is exactly what I needed. Thanks very much!

For anyone who comes later I ended up using `git describe --tags --abbrev=0` and then changing the file name to ${BITBUCKET_REPO_SLUG} to make the whole thing more generic/portable.

0 votes

I'm not sure I understand exactly what you're trying to achieve. Do you want to create a new tag every time you push to master? How do you want the name of the tag to be generated?

AUG Leaders

Atlassian Community Events