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
4,367,825
Community Members
 
Community Events
168
Community Groups

Math Operation within Repository Tag Tag Name Possible?

Edited

Is there a way to perform a math operation within the "Tag Name" field when configuring "Repository Tag" task?

For example, I would like to add a git commit tag based on the current Bamboo build number. However, the build number should be subtracted by 5. So something like this:

0.0/0.0.(${bamboo.buildNumber}-5)

and when bamboo.buildNumber is equal to 16, the tag would be 0.0/0.0.11.

1 answer

1 accepted

1 vote
Answer accepted

Hello @Eduardo Wiputra,

Welcome to Atlassian Community!

The "Repository Tag" task will not do mathematical operations whilst tagging a commit.

You can either:

  1. Use a "Script task" and perform the tagging using a shell script + git command
    or
  2. Use a "Script task" to run your maths and create a properties file with a format such as "custom_tag=0.0/0.0.11" then add an "Inject Bamboo variables" task to consume that variable from the properties file you have just created and then use the custom variable in the "Repository Tag" task as "${bamboo.custom_namespace.custom_tag}" -- You have to define the namespace name whilst injecting the custom variable.

Kind regards,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Hello @Eduardo Alvarenga

Thank you very much for the replies! I wasn't aware of "Injection Task" before I asked the question. Since then, I've experimented with it and realized how powerful it can be.

 

Sincerely,

Eduardo

Like # people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS

Atlassian Community Events