Add a Workflow Notification Strategy

Updated 6 months ago by Archana Singh

You can specify a notification strategy for a Workflow (or for a Workflow phase in a Canary or Multi-Service Workflow) that send notifications using different criteria.

In this topic:

Before You Begin

Step: Add Notification

To add a notification strategy, do the following:

  1. In a Workflow, click Notification Strategy. The default notification step appears.
  2. To edit the default strategy, click the pencil icon next to the strategy item.
  3. To add a new notification strategy, click Add Notification Strategy. The Notification Strategy settings appear.

    Field

    Description

    Condition

    Click the drop-down to select the condition that will execute the notification strategy (Failure, Success, Paused). Click all the conditions that apply.

    Scope

    Select Workflow or Workflow Phase (for Canary or Multi-Service) as the scope for the condition(s) you selected.

    User Group

    Select the User Group to notify when the condition is met within the scope. For information on setting up the notification channels for a User Group, see User Notifications and Alert Settings.

    You can also enter variable expressions. These can be variables specified at the Service, Environment (Service Configuration Overrides), and Workflow level.

    For example, you could create a Service variable named OpsAdmin and use that variable in User Group. Next, you could overwrite that variable in an Environment Service Variables Overrides with a new value, and the new value will be used in User Group.

    Or, you could create a Workflow variable named StageOpsAdmin and use that in User Group.

    For the Workflow scope, you may select Workflow variables using a ${workflow.variables.varName} expression.

    For the Workflow Phase scope, you may select Service variable using the expression (${serviceVariable.varName}). If you have overwritten the value of the Service variable in an Environment's Service Variables Overrides, this expression will return the override value.

Slack Notification Example

Once Slack has been configured in the Harness User Group Notification Settings, you can add the User Group in the Workflow Notification Settings:

When the Workflow deployment is completed, the Slack channel is notified:

In the event of a failure, the Slack is notified because we selected Failure as a Condition.

Notice that the error message is included in the Slack message. If multiple steps failed, they are included in the message:


How did we do?