Is it possible to tag a Bamboo build only if a particular variable is set?

The "VCS Tagging" task works great at tagging our Subversion repository with a custom variable — but only when we remember to fill in that custom variable. Is there any way to configure the VCS Tagging task (or a job that contains it) so that it only runs if a tag name has actually been specified?

To be specific, we've set up a plan in Bamboo with a custom variable called ReleaseVersion. Its default value is blank. Then one of the jobs in the plan has a VCS Tagging task with the tag name:

${bamboo.ReleaseVersion}

If we run the plan by chosing Run Customised... and specify a value for ReleaseVersion then it tags everything correctly with the value we set. However if we just run the default plan it fails because nothing has been set in ReleaseVersion — unsurprisingly we get this exception:

Error occurred while running Task 'Tag Subversion(1)'. This build will fail. Caused by:

com.atlassian.bamboo.task.TaskException: Exception when tagging repository
...
Caused by: org.tmatesoft.svn.core.SVNException: svn: Path 'svn://repository.local/SG/tags' already exists

Basically it's trying to apply an empty string as a tag.

Is there any way to configure Bamboo to skip the task — or the job — if the tag or variable is empty?
We don't want to tag every build, so we don't want to specify the variable every time!

2 answers

1 accepted

0 vote

In your case, it's best to create a script task that will tag or not depending on the variable content.

Good to know that it's not possible with the internal VCS Tagging task.

It does sound to me like a useful feature to add in a future release, though!

I agree that it would be a useful feature - I've created a jira request for a slightly more generalised feature

https://jira.atlassian.com/browse/BAM-11257

It would be a useful feature if any task could be run conditionally on the value or existence of the variable, including the VCS tagging task.

I've made a feature request here for this: https://jira.atlassian.com/browse/BAM-11257

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
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,784 views 0 6
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