[Bamboo Knowledge Base]
Variables tasks in Bamboo allow you to:
The 'Inject Bamboo variables' task allows you to read the values for variables from a file, and create those variables in your build plan.
The file should use a 'key=value' format.
You can choose if those variables should have local scope (in which case they cease to exist when the job finishes) or result scope (in which case they are persisted and passed into subsequent stages or related deployment releases).
See Configuring tasks for help on creating a task.
The 'Dump variables to log' task simply writes out the current values of all variables used in the build.
See Configuring tasks for help on creating a task.
Q. What happens if the same key is used twice?
A. The last assignment will prevail. If you set the scope to local variable with the same key as an existing result variable, the value of the result variable will be restored when the job finishes.
Q. What if I manually set a variable with the same key as a result variable?
A. Same as above – the last assignment wins.
Q. Can I manually override a result variable in a subsequent manual stage?
A. Yes.
Q. What if 2 jobs in the same stage create the same variable?
A. The variable will exist but it is undefined which value will ultimately be assigned to it.
Q. Is restarting builds, re-running failed jobs or continuing from a manual stage supported?
A. Of course! One caveat though: if you restart a build which has an associated deployment release, the variable in the release will not be refreshed. We're working on that...