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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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
Community Members
Community Events
Community Groups

Can I assign a value to a bamboo variable in script?

I want to be able to use a script to parse a file, read out a value and then assign this value to a plan variable. I cannot see a way of assigning the variable however.

I have tried various scripts like:

Write-Output Initial Date: "${bamboo.CURRENT_ASSEMBLY_VERSION}"
set "bamboo_CURRENT_ASSEMBLY_VERSION=$rawVersionNumber"
Write Output Should have set to: $rawVersionNumber
Write-Output Using the shared assembly version number: "${bamboo.CURRENT_ASSEMBLY_VERSION}"

Is this possible with Elastic Bamboo?

6 answers

4 years later and we still don't have a "good" solution for managing variables that might come up during the build... why is this not a surprise with Atlassian. 

Alexey Chystoprudov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Mar 20, 2018

Inject Variable task is part of Bamboo and it should be used to propagate variables from environment to other tasks, jobs and stages

Like # people like this

Hi Alex,

I need variable with date.
Trying to get date in inline or file script: DateStamp="$(date +%m-%d-%Y)"


Further attempts to access variable failed. E.g. ${bamboo.DateStamp} returns error "bad substitution" in current script as well as next task script.


Is any way to create accessible variable during the build?

Alexey Chystoprudov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jul 26, 2018 • edited

@Sergey, as I wrote you should use Inject Variable task

1. As part of you job create file in format


2. Add task Inject Variables next to task you created properties file, configure it to read file. It will add variables to build context

3. Use variables in other tasks within this job or next stages

Thank you Alex.
I did it with injector. It looks ok for cases like my when you need add one variable or group of variables at once. One task for file creation, one injection task.

But if I need change variables several times? E.g. 17. 
Is it really I need to add 17 tasks for file creation/update and 17 injection tasks? 

Like NagiReddy1234 likes this
Alexey Chystoprudov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jul 26, 2018

I'm afraid yes. But please don't do it manually, use Bamboo Specs to automate your plan configuration. Cause it will be a pain to maintain these 17 tasks

Thank you. I'll mention it in future.

I just used to use variables as variables, not a constants ) It was a surprise for me that Bamboo doesn't allow to use them like ${var} across jobs and scripts.

Like anddave likes this

Yknow what tool totally DOES do this?  ActiveBatch by ASCI.  :) Just sayin.  I love Bamboo but also the nuisance factor is higher than it needs to be.

1 vote
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Aug 03, 2014

You can use the injection variable plugin to simulate this. Basically you write out to a text file, then read it in from the injection plugin task once it's there, you can use it as a variable within the same stage. I think you have to reload it in a new stage, which is a nuisance but works fine.

I have written an internal prototype that I can't share with you, BUT I can tell you what I did.  I downloaded Atlassian SDK and wrote a plugin for Bamboo that adds a REST call to set a plan branch var.

This is disappointing. The sole purpose of declaring variables is to be able to update it from within the build/tasks.

Yeah, that would be ideal.

Ah, this plugin doesn't seem to be available for the cloud. We are running Elastic Bamboo. I thought that this meant that it is not currently able to be run with our version?

0 votes
Felipe Kraemer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jul 15, 2014

Hi Mark,

It is currently impossible to change a variable value from within tasks while the build is running. This is being tracked here:

I would suggest adding any comments to the issue above as well as voting on the issue to create it's popularity and likelihood of being implemented in a future release.

For more information on how Atlassian implements new features and improvements please see the following document:

Kind regards,
Felipe Kraemer
Atlassian Support

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events