Documentation for Automation with AWS AWS 1.0 – other releases are available in the Automation with AWS Documentation Directory.
View

Unknown macro: {spacejump}

or visit the current documentation home.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Use the Invoke Lambda Function action to process Bamboo notifications, JIRA workflow transitions and JIRA Service Desk automation rule executions with AWS Lambda, which lets you run code without provisioning or managing servers:

You pay only for the compute time you consume - there is no charge when your code is not running. With Lambda, you can run code for virtually any type of application or backend service - all with zero administration. Just upload your code and Lambda takes care of everything required to run and scale your code with high availability. You can set up your code to automatically trigger from other AWS services or call it directly from any web or mobile app.

Integrations

You can use the Invoke Lambda Function action with the following integrations:

Filter by label

There are no items with the selected labels at this time.

Configuration

To configure an Invoke Lambda Function action:

  1. Complete the following settings:

    Parameters

    Specify the action parameters according to the following skeleton in JSON format – refer to lambda . invoke for details:

    You typically only specify the FunctionName and Payload parameters, and not all parameters documented for lambda . invoke are applicable here (invocation-type and log-type are not meaningful, and outfile is not supported).

    You can inject contextual variables into the remote action payload, refer to Entity Variables for details.

    Invoke Lambda Function skeleton
    {
        "FunctionName": "",
        "Payload": {},
        "Qualifier": "",
        "ClientContext": {}
    }

Entity Variables

You can inject contextual workflow variables with workflow entities into the remote action payload template – currently available entities are:
  • Page:
    DeploymentResult — The Bamboo ${deploymentResult} entity returns the following JSON shape:
    DeploymentResult shape (JSON)
    {
      "agentId": "<>",
      "deploymentVersionName": "<>",
      "environmentId": "<>",
      "executedDate": "<>",
      "finishedDate": "<>",
      "id": "<>",
      "queuedDate": "<>",
      "reasonSummary": "<>",
      "startedDate": "<>"
    }
  • Page:
    Plan — The Bamboo ${plan} entity returns the following JSON shape:
     Plan shape (JSON)
    {
      "averageBuildDuration": "<the average duration of the recent builds>",
      "buildKey: "<the build's unique key>",
      "buildName": "<the build specific portion of the name>",
      "currentStatus": "<a string key as to what the status is>",
      "description": "<the instant messaging content>",
      "firstBuildNumber": "<the number of the first build>",
      "id": "<the database id of the plan>",
      "key": "<the plan's unique key>",
      "lastBuildNumber": "<the number of the latest build>"
    }


  • Page:
    ResultsSummary — The Bamboo ${resultsSummary} entity returns the following JSON shape:
    ResultsSummary shape (JSON)
    {
      "buildAgentId": "<the id of the latest agent that built the result>",
      "buildCancelledDate": "<when the build was cancelled>",
      "buildCompletedDate": "<when the build finished>",
      "buildDate": "<>",
      "buildNumber": "<>",
      "buildTime": "<>",
      "changesListSummary": "<>",
      "duration": "<the duration of the build in milliseconds>",
      "durationDescription": "<the duration in a 'pretty' format>",
      "formatVersion": "<>",
      "id": "<>",
      "logSize": "<the size of the log file associated with this result>",
      "processingDuration": "<>",
      "processingDurationDescription": "<>",
      "queueTime": "<>",
      "reasonSummary": "<>",
      "relativeBuildDate": "<>",
      "relativeBuildStartedDate": "<the relative started time (duration) compared to current date>",
      "relativeQueueDate": "<>",
      "restartCount": "<>",
      "shortReasonSummary": "<>",
      "testSummary": "<>",
      "timeToFix": "<the stored version of how long (milli seconds) it took for this build to fix a failure>"
    }
  • Page:
    Comment

    The Jira ${comment} entity returns the same JSON shape returned from the Jira REST API when a comment is retrieved – refer to the GET /rest/api/2/issue/{issueIdOrKey}/comment documentation for details.

  • Page:
    User

    The Jira ${user} entity returns the same JSON shape returned from the Jira REST API when a user is retrieved – refer to the GET /rest/api/2/user documentation for details.

  • Page:
    Issue

    The Jira ${issue} entity returns the same JSON shape returned from the Jira REST API when an issue is retrieved with NO expand parameters – refer to the GET /rest/api/2/issue/{issueIdOrKey} documentation for details.

  • Page:
    Notification — The Bamboo ${notification} entity returns the following JSON shape:
    Notification shape (JSON)
    {
      "description": "<a description>",
      "emailSubject: "<the email subject>",
      "htmlEmailContent": "<the HTML email content>",
      "imContent": "<the instant messaging content>",
      "textEmailContent": "<the text email content>"
    }
  • Page:
    Event — The core ${event} entity returns the following JSON shape:
    Event shape (JSON)
    {
      "traceId": "<UUID>",
      "timestamp: "<ISO 8601>"
      "simpleName": "<simple Java class name, if available>"
    }

Examples

  • Page:
    Invoke Lambda Function — This parameters template demonstrates the Invoke Lambda Function action:

    JSON escaping requirements

    If a parameter within the JSON formatted parameters template is a JSON structure in itself (e.g. the Lambda function payload), it needs to be escaped before adding it as a value - this has two implications:

    • (tick) custom content needs to be escaped, which can be achieved by Composing action payloads with utility functions, specifically the $util.escapeJson() function

    • (warning) variables with conflicting content (e.g. multi line variables like JIRA's $issue.fields.description or Bamboo's $notification.textEmailContent or JSON structures retrieved via JSONPath) need to be escaped twice, via $util.escapeJson($util.escapeJson(...)) - we are exploring options on how to make this easier in a future release

    Invoke Lambda Function parameters example (escaped manually)

    {
      "FunctionName": "arn:aws:lambda:ap-southeast-2:123456789012:function:sample-AutomationWithAWSQuickstartLamb-1RRX37PWXZXLS",
      "Payload": "{ \"Event\":\"$event.simpleName\", \"Timestamp\": \"$event.timestamp\", \"TraceID\": \"$event.traceId\"}"
    }

    Invoke Lambda Function parameters example (escaped with utility function)

    {
      "FunctionName": "arn:aws:lambda:ap-southeast-2:123456789012:function:sample-AutomationWithAWSQuickstartLamb-1RRX37PWXZXLS",
      "Payload": "$util.escapeJson('{
        "Event": "$event.simpleName",
        "Timestamp": "$event.timestamp",
        "TraceID": "$event.traceId"
      }')"
    }

How-to Articles

Filter by label

There are no items with the selected labels at this time.

Frequently Asked Questions (FAQ)

  • No labels