Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated to release 2.21.0.

...

width64%
Excerpt

All tasks support configuration via Bamboo variables – variables can be substituted in task parameters for AWS resource management, and variables are automatically defined from AWS resources affected by a task.

Info

To empower advanced build and automation scenarios, it his highly recommended to become acquainted with

...

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

Image Removed

Column
width32%
Panel
bgColor#eeeeee

On this page:

Table of Contents

 

...

using global, plan, deployment, or build-specific Bamboo variables.


Image Added

Variable substitution

Variables are substituted in all

...

task configuration text fields (e.g. Stack Name, Template URL, Instance ID, Volume ID etc.).

...

Tip

Configuration as code

Configuration as code is not yet natively supported in Bamboo. You can partially work around this limitation as outlined in How to provide task configuration from an external source like a file.

Note

Sensitive data masking

Tasks may emit sensitive data like credentials which are not supposed to surface in build logs - this can be achieved as follows:

  • if the variable key contains the phrase "password", the value will be masked with "********" in the build logs;

...

  • for example, if the key is "password", "awsAccessKeyPassword" or "awsSecretKeyPassword", the build log will show the substituted value as "********"

Variable

...

definition

Variables are defined by

...

most tasks for reuse in subsequent

...

tasks, see Bamboo Variable Substitution/Definition for details, and each task's documentation for example log outputs.

  • (info) A task's generated variables might get amended with respective AWS API additions over time - a live build log will always provide the most current variable shape accordingly.

  • We are contemplating to evolve the current key/value based approach to one based on hierarchical JSON payloads, please watch/vote/comment on the following issue to guide our resp. roadmap:

    Jira Legacy
    serverSystem JIRA
    serverIdfac61c2e-db0a-39da-bb3c-e0dc0ef556f0
    keyUAA-92

Variable namespace and scope

Image Added

As of release 2.21.0, you can now specify the namespace and scope for Bamboo variables generated by all applicable AWS tasks (this is similar to the Inject Bamboo variables task that has been included with Bamboo as of release 6.7):

You can now pass a variable between stages, pass a variable from a plan to a deployment project, and you can use multiple tasks within the same job without overriding variables from preceding tasks by adjusting the namespace. The tasks default to the preceding behavior with local scope and a custom.aws namespace so that this remains an opt-in choice for advanced use cases.

Example

This example  illustrates the variable generation pattern:

  • 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.

...

 

Info
title 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 Task Variables

The following variables are available in the various tasks:

AWS CloudFormation Stack

...

  • 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
    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-

...

  • properties converted to variables: StackName, StackStatus, CreationTime, LastUpdatedTime
  • collection converted to variables: tags, parameters, resources, outputs

...

  • 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-

...

  • properties converted to variables: ResourceStatus, LogicalResourceId, PhysicalResourceId, Timestamp

...

  • a316b842.LaunchTime: 20150716T080402Z
    ... bamboo.custom.aws.ec2.

...

  • instance.

...

  • resources.i-

...

titleLegacy Variable Naming

CloudFormation Variables had been named inconsistently in previous versions of this add-on - the following names are deprecated, but remain available for compatibility reasons for the time being:

...

  • 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.

...

  • Note: The variables with legacy naming without prefix remain available for compatibility (e.g. bamboo.StringWithRegex=Hello)

AWS Elastic Beanstalk Environment

...

  • first.PrivateDnsName: ip-10-0-0-241.ec2.internal
    ... bamboo.custom.aws.

...

  • ec2.

...

relevant resource values for each affected environment, e.g. custom.aws.cloudformation.stack.resources.SampleStack-42.StackStatus=CREATE_COMPLETE

  • properties converted to variables: EnvironmentId, ApplicationName, CNAME, DateCreated, DateUpdated, Description, EndpointURL, EnvironmentName, Health, SolutionStackName, Status, TemplateName, VersionLabel

Amazon EC2 Instance

...

  • instance.first.PrivateIpAddress: 10.0.0.241
    ... bamboo.custom.aws.ec2.instance

...

  • .first.PublicDnsName:
    ... bamboo.custom.aws.ec2.

...

  • properties converted to variables: InstanceId, State, PrivateDnsName, PrivateIpAddress, PublicDnsName, PublicIpAddress, LaunchTime
  • collection converted to variables: tags

Amazon EC2 Image

...

  • instance.first.PublicIpAddress: null
    ... bamboo.custom.aws.ec2

...

  • .instance.first.LaunchTime: 	20150716T080402Z
    ... bamboo.custom.aws.ec2.

...

  • instance.

...

  • properties converted to variables: ImageId, State
  • collection converted to variables: tags

Amazon EBS Snapshots

...

  • 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

Contextual entity variables

Insert excerpt
Injecting contextual entity variables into task configurations
Injecting contextual entity variables into task configurations
nopaneltrue

Refer to Injecting contextual entity variables into task configurations for details.