use new stash repositories in bamboo to create tags on a build

I'm trying to use the new Stash repositories feature in bamboo (as of 5.5 I believe).  This is more important now that the legacy stash support is removed from 5.7.  The problem I am having is that I want to create tags on a repository on successful completion of a stage.  Originally I did this by using a script, the git repository URL variable, and a _netrc file to provide the security settings.   Now if I use the new stash repositories, everything is ssh, so I need a copy of the ssh key that bamboo is using.  But there doesn't seem to be any way to get that.  The only thing I can think of is to also store the https url for a repository in a variable, which seems like a maintenance problem.  Like what happens when someone updates the repository but not the https URL, then we start tagging the wrong repo.

Anyone have a way to do this?

2 answers

0 vote

What about using Bamboo variables in your script task? If you insert

${bamboo.planRepository.0.repositoryUrl}

in your script task, it will be converted into actual URL.

Unfortunately, that ends up being a ssh:// url, which is useless without a ssh key.  If you try and do a git push using that url, you end up locking up the build.  Using the legacy stash connections, I use the following script to push a tag to the repo

git tag publish/${bamboo.inject.packageversion} ${bamboo.repository.revision.number} 
git push ${bamboo.repository.git.repositoryUrl} publish/${bamboo.inject.packageversion}

 When we use the new stash repositories, this hangs, because it doesn't have the ssh private key to push to the repo.

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,087 views 0 5
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