Missed Team ’24? Catch up on announcements here.

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

Git tag a specific commit hash

Philipp
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 18, 2024

Requirements:

- Build runs in a docker container

 

Usecase:

1. I have 10 builds that builds an artifact that is shared with the deployment

2. In the deployment I download the artifact and want to upload it into an artifact repository.

3. Now I deploy build #7 out of the 10 builds.

4. I want to tag the commit that was used at build #7 to build my artifact but the tagging needs to happen in the deployment.

 

How do I do that?

 

I am able to tag in an deployment but I have no way to push the tag.

That code is able to create a tag on my specific commit:

export TAG_HASH=384a34eaa1c1ee58ce198fabd95831dddd3cc4b8

export TAG_NAME=0.0.1

git tag -a ${TAG_NAME} ${TAG_HASH} -m "${TAG_HASH}"

echo "Tag done"

Hence our bamboo uses ssh keys with bitbucket and I use a container build I am not able to push via my script.

The only way to push is with the bamboo task vsc push. But with that task it does not push git tags as well.

And the other option to use the bamboo task "git tag" I can only tag the latest commit, so that is also no option for me.

 

How can I solve this?

1 answer

1 vote
Jyothi Charupalli
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 18, 2024

Hi @Philipp ,

Welcome to Atlassian Community!

We understand that you want to tag a specific commit in the remote repository from Bamboo through a script task.

We have a below Bamboo KB article which explains the same and how to setup ssh keys to authenticate remote repository through script task.

How-to-push-a-repository-tag-for-a-specific-commit-from-bamboo-to-a-remote-repository-1333329967.html 

Please also refer to the KB article for a more detailed explanation of How to set up an SSH key-pair for a Bitbucket repository from Bamboo. Even though it explains for the Bitbucket Cloud repository same steps mentioned under the section To generate SSH key-pair: can be followed for generating SSH key pair for the Bitbucket server repository as well.

I hope this helps!

Best Regards,

Jyothi

*please don't forget to Accept the answer if your query was answered**

Philipp
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 18, 2024

I know that is an option but than I have to handle a secret myself and make sure the keys are in all repos that I want to tag.

A more comfortable way would be to enable the internal bamboo task "Repository Tag"  to have a parameter that uses the hash to tag of a specific commit. So bamboo can use the existing keys generated by the linked repository.

Is there maybe already a ticket for that feature that I can upvote?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events