• Home
  • Platform modules
  • Cloud Automation
  • Partner integrations
  • LaunchDarkly

Integrate LaunchDarkly with Dynatrace Cloud Automation

Integrating Dynatrace Cloud Automation with LaunchDarkly allows you to automatically enable or disable feature flags to remediate problems when specific operational health thresholds or alerts are triggered, or as part of software delivery lifecycle delivery and testing.

To integrate Dynatrace Cloud Automation with LaunchDarkly, follow the instructions below.

Prerequisites

LaunchDarkly

Dynatrace

LaunchDarkly

  • A LaunchDarkly Enterprise feature account.

  • Enable the Writer role on your LaunchDarkly account.

    Note: If you use custom roles to manage your team, your member account must have the createTriggers action in order to create flag triggers.

  • Create a feature flag for Cloud Automation.

  • Create a trigger and configure it to take action on the Cloud Automation feature flag.

    How to create a trigger
    1. On your LaunchDarkly dashboard, go to Feature flags and select the flag you want to control from your Cloud Automation sequence.

    2. Go to Settings, select Add trigger, and enter the following values:

      • For Trigger type, enter Dynatrace.
      • For Action, select Update flag targeting to ON.
    3. Select Save trigger.

    The generated URL will be used at a later step.

Dynatrace

  • Create a Cloud Automation project with a shipyard file that has a custom task (for example, setflag) to trigger the LaunchDarkly webhook subscription.

  • Add the LaunchDarkly flag trigger obtained above as a Cloud Automation secret.

    How to add the flag trigger as a Cloud Automation secret
    1. On the Cloud Automation bridge, select your Cloud Automation project.

    2. Select Settings, and then select Secrets.

    3. Select Add Secret and enter the following values:

    • Name: Enter a name for the secret (for example, launchdarkly).

    • Scope: Select keptn-webhook-service.

    • Key/Value: Enter your values for the key/value pair (for example, key: myfeature, value: <your_trigger_GUID>1).

      1

      Use the URL generated in LaunchDarkly prerequisites. For example, if the URL is https://app.launchdarkly.com/webhook/triggers/1234abcd, the key value should be 1234abcd.

    1. Select Add secret.

Set up the LaunchDarkly webhook subscription

Use case: Set up a passive webhook subscription that toggles a flag to an ON or OFF state. The Cloud Automation sequence will not wait for the LaunchDarkly flag trigger to send back a Cloud Automation sequence task finished event.

  1. On the Cloud Automation bridge, select your Cloud Automation project.

  2. Select Settings, and then select Integrations.

  3. Select webhook-service from the list, and then select Add subscription.

  4. Enter the following values:

    • Task: Select the task associated with your shipyard file (in this case, setflag).
    • Task suffix: Select triggered.
    • Request method: Select POST.
    • URL: Enter your URL endpoint, using the placeholder of the secret created earlier (for example, https://app.launchdarkly.com/webhook/triggers/{{.secret.launchdarkly.myfeature}}).
  5. Select Add custom header and enter the following values:

    • Name: Enter Content-Type.
    • Value: Enter application/json.
  6. optional Enter a Custom payload.

LaunchDarkly triggers work without any request body, but you can add different attributes to enhance the flag's audit log. Any combination of properties will return information, and any attribute is optional.

Example:

Note: Be sure to replace the URL in the example below with your Cloud Automation web console URL.

json
{ "eventName": "{{.type}}", "value": "{{.data.status}}", "url": "https://example.cloudautomation.live.dynatrace.com/bridge/project/{{.data.project}}/sequence/{{.shkeptncontext}}/stage/{{.data.stage}}" }
  1. Under Send finished event, select automatically.

  2. Select Create subscription.

Trigger a sequence

Cloud Automation triggers LaunchDarkly whenever the defined task in the sequence is triggered.

To trigger the sequence, you can send the event command in the Keptn CLI.

  1. Create a file called triggered-event.json.

Example:

json
{ "type": "sh.keptn.event.mystage.mysequence.triggered", "specversion":"1.0", "source":"manual-trigger" "data":{ "project":"demo", "stage":"production", "service":"myservice" }
  1. Send the event.

    bash
    keptn send event --file triggered-event.json

After sending the event, you can

  • Monitor the sequence progress on the project’s Cloud Automation sequence page
  • Monitor the flag targeting status on the LaunchDarkly flag targeting page
  • Monitor the audit log in LaunchDarkly to see the changes made to your flag after the trigger execution
Related topics
  • Cloud Automation

    The capabilities of Dynatrace Cloud Automation