Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Automate Tag Creation on Bitbucket?

Yashpal Bhardwaj December 4, 2017

I want to create a Tag corresponding to a successful build of a given branch  (say develop or release). 

That is whenever there's a success of build on newly pushed/merged code, I want to kickoff a Script or something like that which can create a Tag for current state of that branch.

Couldn't find anything even related on community so directly asking here.

1 answer

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 4, 2017

Where are you building the code? Bamboo, Jenkins? Most CI apps have a script task that you can use to create tags and push to Bitbucket using the git commands.

Make sure you have SSH keys added on the machines where the build is running and are given the right permissions in Bitbucket.

Yashpal Bhardwaj December 5, 2017

Hi Jobin, We're using Jenkins for CI & CD. But I couldn't find any way to create tags and push to Bitbucket using the git commands.

 

Yes, I have SSH keys added on the machines where the build is running and are given the write permissions in Bitbucket.

 

A reference could be a help.

 

Thank you for replying.

Yashpal Bhardwaj December 5, 2017

And it would be good if I could skip Jenkins from the way and Just use Bit Bucket Merge Checks, Event Handlers or Script Post Hooks etc.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2017

You can just add a sheel script and execute it from the build.

The script will have "git tag .." and "git push .." commands to create a tag and push it to the remote. Make sure you are in the correct repo before you tag it.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events