Using automation rules

This document describes automation rules, which are actions that can be taken on your delivery pipeline automatically. For example, you can configure your delivery pipeline so that promotion into a specific target happens automatically, under the right circumstances.

You can only use automation rules that are built into Cloud Deploy. The available automation rules are listed in this document.

Available automation rules

The following automation rules are available in Cloud Deploy:

Rule Description
promoteReleaseRule Automatically promotes a release into the indicated target after successful

rollout in the previous target in the progression.

advanceRolloutRule Automatically advances a rollout from the indicated

phase to the next phase.

Configuring automation rules

Configuration for each automation rule depends on the specific rule. This section describes configuration that all rules have in common, as well as how to configure each of the available rules.

The following sections describe configuration specific to individual automation rules. See Automate your deployment for configuration of the automation itself.

Configuring a promoteReleaseRule automation rule

The promoteReleaseRule rule promotes your release after a successful rollout into a target. For example, if you have three targets, you can set up this rule so that when the release is successfully deployed into the first target, it's automatically promoted to the second target.

When you configure a promoteReleaseRule automation, you can specify either a target to promote to (destinationTargetId) or @next. When the rollout finishes successfully in target specified in the Automation definition, the release is then promoted to the target specified in destinationTargetId, subject to a wait time interval.

You can also promote a release to a specific phase in the intended target, using the destinationPhase property.

rules:
- promoteReleaseRule:
    name: "[RULE_NAME]"
    wait: [WAIT_TIME]
    destinationTargetId: "[TO_TARGET]"
    destinationPhase: "[TO_PHASE]"

Where:

  • [RULE_NAME]

    Is any name you want to give to this rule. This name must be unique within the automation resource.

  • [WAIT_TIME]

    Is the amount of time, in minutes, to wait after the release is ready for promotion before it's promoted. For example, 1m. The m is required.

    The default value is 0, or no wait time. The maximum is 20160m (or 14 days).

  • [TO_TARGET]

    Is the targetId of the target to promote to.

    This can also be @next, which promotes the release automatically to the next target after the target specified in the selector.targets property in this automation config. This is the default if you omit the value from destinationTargetId.

  • [TO_PHASE]

    Is the phase name of the phase you want to promote to, for example canary-25 or stable. This property is optional; if you omit it, the release is promoted to the first phase in the target.

Configuring an advanceRolloutRule automation rule

The advanceRolloutRule advances your rollout, automatically, after successful completion of one phase, into the next phase. This automation rule is useful for canary deployments. For example, if you have a canary deployment strategy configured on a target, with phases of 25%, 50%, and stable, you could configure an automation rule that advances the phase automatically to stable after the 50% phase finishes.

When you configure a advanceRolloutRule automation, you identify the phase to advance from (the sourcePhase).

rules:
- advanceRolloutRule:
    id: "[RULE]"
    sourcePhases: ["[START_PHASE]", "[START_PHASE]"...]
    wait: [WAIT_TIME]

Where:

  • [RULE]

    Is any name you want to give to this rule. This name must be unique within the delivery pipeline.

  • [WAIT_TIME]

    Is the amount of time, in minutes, to wait to advance the rollout after the rollout is ready. For example, 1m. The m is required.

    The default value is 0, or no wait time. The maximum is 20160m (or 14 days).

  • ["[START_PHASE]", "[START_PHASE]"...]

    Is the phase or phases from which the rollout is automatically advanced. That is, when any of the phases listed finish successfully, the rollout is automatically advanced from that phase to the next phase.

    Phase names are case sensitive. Also, these phase names are optional; if you omit sourcePhases, all phases in the rollout are automatically advanced.

What's next