Add a Workflow Notification Strategy
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:
- In a Workflow, click Notification Strategy. The default notification step appears.
- To edit the default strategy, click the pencil icon next to the strategy item.
- To add a new notification strategy, click Add Notification Strategy. The Notification Strategy settings appear.
Click the drop-down to select the condition that will execute the notification strategy (Failure, Success, Paused). Click all the conditions that apply.
Select Workflow or Workflow Phase (for Canary or Multi-Service) as the scope for the condition(s) you selected.
User GroupThe default User Group is Account Administrator. You can change this, but it is always the default when a new Workflow is created.
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
OpsAdminand 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
StageOpsAdminand use that in User Group.
For the Workflow and Workflow Phase scopes, you can select Workflow variables using a
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: