Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Adjusted/Fixed variable prefix.
Section
Column
width64%

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

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

 


Column
width32%
Panel
bgColor#eeeeee

On this page:

Table of Contents

...


Variable Substitution

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

...

  • variables have a dedicated prefix like bamboo.custom.aws.*, with * being a task specific prefix, e.g. bamboo.custom.aws.cloudformation.stack
  • variables referring 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.instance.resources} with values i-a316b842;i-b4210842 (line 2)
  • you can refer to these variables from subsequent tasks via something like ${bamboo.custom.aws.ec2.instance.resources.i-a316b842.PrivateDnsName} (line 6) - however, given script access to such a named resource is difficult, there is a shortcut to ease reusing the first (and often only) affected resource via something like ${bamboo.custom.aws.ec2.instance.first.i-a316b842.PrivateDnsName} (line 19):

    Code Block
    languagetext
    linenumberstrue
    Creating common variables for 2 resources affected by task:
    ... bamboo.custom.aws.ec2.instance.resources: i-a316b842;i-b4210842
    Creating resource variables for instance 'i-a316b842':
    ... bamboo.custom.aws.ec2.instance.resources.i-a316b842.InstanceId: i-a316b842
    ... bamboo.custom.aws.ec2.instance.resources.i-a316b842.State: running
    ... bamboo.custom.aws.ec2.instance.resources.i-a316b842.PrivateDnsName: ip-10-0-0-241.ec2.internal
    ... bamboo.custom.aws.ec2.instance.resources.i-a316b842.PrivateIpAddress: 10.0.0.241
    ... bamboo.custom.aws.ec2.instance.resources.i-a316b842.PublicDnsName:
    ... bamboo.custom.aws.ec2.instance.resources.i-a316b842.PublicIpAddress: null
    ... bamboo.custom.aws.ec2.instance.resources.i-a316b842.LaunchTime: 20150716T080402Z
    ... bamboo.custom.aws.ec2.instance.resources.i-a316b842.tags: Name
    ... bamboo.custom.aws.ec2.instance.resources.i-a316b842.tags.Name: taws-it-2.0.0
    Creating resource variables for instance 'i-b4210842':
    ... <skipped>
    Creating common variables for first resource affected by task:
    Creating resource variables for instance 'i-a316b842':
    ... bamboo.custom.aws.ec2.instance.first.InstanceId: i-a316b842
    ... bamboo.custom.aws.ec2.instance.first.State: running
    ... bamboo.custom.aws.ec2.instance.first.PrivateDnsName: ip-10-0-0-241.ec2.internal
    ... bamboo.custom.aws.ec2.instance.first.PrivateIpAddress: 10.0.0.241
    ... bamboo.custom.aws.ec2.instance.first.PublicDnsName:
    ... bamboo.custom.aws.ec2.instance.first.PublicIpAddress: null
    ... bamboo.custom.aws.ec2.instance.first.LaunchTime: 	20150716T080402Z
    ... bamboo.custom.aws.ec2.instance.first.tags: Name
    ... bamboo.custom.aws.ec2.instance.first.tags.Name: taws-it-2.0.0
  • (info) 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)

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

...