Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Extracted Variables section to dedicated page.

...

Bamboo Variable Substitution/Definition

Info
To empower advanced build and automation scenarios, it his highly recommended to become acquainted with Using Global, Plan or Build-specific Variables. .

All Tasks support Bamboo variables, both substituting them within parameters for AWS resource management and defining them from created AWS resources.

Image Removed

Variable Substitution

Variables are substituted in all Task configuration text fields (e.g. Stack Name, Template URL, Instance ID, Volume ID etc.).

Please note the following feature:

  • if the variable key contains the phrase "password", the value will be masked with "********" in the build logs; e.g. if the key is "password", "awsAccessKeyPassword" or "awsSecretKeyPassword" the build log will show the substituted value as "********"

Variable Definition

Variables are defined by all Tasks for reuse in subsequent Tasks as follows:

  • variables have a dedicated prefix like bamboo.custom.aws.*, with * being a task specific prefix, e.g. bamboo.custom.aws.cfn.stack
  • variables refering to a collection of resources provide their ids in a semicolon separated list (i.e. the same format available on input), e.g. ${bamboo.custom.aws.ec2.image.resources} with values ami-985b21f1;ami-9a5b21f3
  • you can refer to these variables from subsequent tasks via something like ${bamboo.custom.aws.cfn.stack.sampleStackOutputKey}
  • these variables are also available as environment variables in the Script Task for example, albeit named slightly different, e.g. $bamboo_custom_aws_cfn_stack_StringWithRegex (Unix) or %bamboo_custom_aws_cfn_stack_StringWithRegex% (Windows)

Please note the following constraints:

  • variables are only reusable in subsequent tasks and not in other jobs/stages due to the implied concurrency, see the following discussion and workaround

Available variables per Task are as follows:

...

  • the collection of affected stack resources, e.g. bamboo.custom.aws.cfn.stack.resources=i-3280997f;vol-e1debbcd;test-stack-SecurityGroup-KZWPADIUPCL6
  • the status of each affected stack resource, e.g. bamboo.custom.aws.cfn.stack.i-3280997f=CREATE_COMPLETE
  • the collection of generated stack outputs, e.g. bamboo.custom.aws.cfn.stack.outputs=sampleStackOutputKey;StringWithRegex;...
  • the value of each generated stack output, e.g. bamboo.custom.aws.cfn.stack.StringWithRegex=Hello
    • Note: The variables with legacy naming without prefix remain available for compatibility (e.g. bamboo.StringWithRegex=Hello)

...

  • the collection of affected instances, e.g. bamboo.custom.aws.ec2.instance.resources=i-fa7b4596;i-080eec64
  • the status of each affected instance, e.g. bamboo.custom.aws.ec2.instance.i-fa7b4596=started

...

  • the collection of affected images, e.g. bamboo.custom.aws.ec2.image.resources=ami-985b21f1;ami-9a5b21f3
  • the status of each affected instance, e.g. bamboo.custom.aws.ec2.image.ami-985b21f1=available

...

See Bamboo Variable Substitution/Definition for details.

AWS Credentials

The AWS credentials need to be specified for each task currently, which can be cumbersome quickly. Pending a more generic solution, it is already possible to ease this a bit via variable substitution as follows:

...