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

Math Operation within Repository Tag Tag Name Possible?

Eduardo Wiputra
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!
September 16, 2022

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
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 19, 2022

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-- 

Eduardo Wiputra
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!
September 19, 2022

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
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 19, 2022

Thank you @Eduardo Wiputra

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events