aragorn ara
aragorn ara

Reputation: 165

Bamboo Atlassian: How to share a variable between stages

I am relatively new to Bamboo. I have a question regarding stages implementation with shared variable. I have two stages:

Stage 1: Set variable "Sample_build_number"

Stage 2: Use variable "Sample_build_number"

Any help with this is very much appreciated.

Upvotes: 2

Views: 9360

Answers (1)

shonky linux user
shonky linux user

Reputation: 6428

You can write your variables to a simple property file in Stage 1, and share the property file as an artifact.

Sample_build_number=myvalue

In your Stage 2 job use the Inject Bamboo variables task to read the property file.

Your variable is available in later job steps as ${bamboo.inject.Sample_build_number}

Note this uses the Bamboo Inject Variables Plugin that is bundled in versions 5.7 and later. If you have an earlier version of Bamboo your administrator will need to download and install the plugin.

Upvotes: 4

Related Questions