Notifications
This tutorial focuses on how to notify users of different pipeline events using popular notification methods.
Before you begin
Before you start this tutorial, you need to have a Harness CD pipeline with active delegates and connectors. Please follow this tutorial to get started with Harness Continuous Delivery (CD). The tutorial below uses the Harness resources created as part of the get started tutorial.
Harness User Group: This tutorial uses Harness user groups to manage user access. Create a user group named
notification-demo
at the account level, and add yourself as a user.
Get Started with Notifications
- Select the Notify icon on the right side of the Harness pipeline studio.
- In New Notification, add a name for your notification.
- In Pipeline Events, select the events (pipeline or stages) that will trigger the notification.
- For stage-based events, select the stage name that you want to trigger the notification and click Next.
- Slack
- PagerDuty
- Microsoft Teams
- Webhook
- In Notification Method, select
Email
. - For email notifications, simply type in the email addresses that you want to notify.
- Enter multiple addresses as a comma-separated list. For example,
john.doe@example.io,qateam@example.io
.
- Enter multiple addresses as a comma-separated list. For example,
- Additionally, use the user group that you created above to receive notifications.
- Select Finish and your notification is created.
Prerequisite
- Create a Slack webhook. For more information, go to the sending messages using incoming webhooks tutorial provided by Slack.
- Copy and store the webhook URL for further use.
In Notification Method, select
Slack
.Paste the webhook in Slack Webhook URL. Harness recommends that you add the webhook as an encrypted text secret and reference it in Slack Webhook URL as an expression.
- For example,
<+secrets.getValue("slackwebhookURL")>
.
- For example,
Now additionally you can use the user-group created above, if it is associated with the slack channels to send notifications, for more information on the same follow the instructions mentioned here
Select Finish and your notification is created.
Prerequisite
- Create a PagerDuty service key to integrate with Harness.
- Copy or store this key from PagerDuty's Configuration > Services > Service Details dialog > Integrations tab.
- In Notification Method, select
Pagerduty
. - Create an encrypted text secret with the name
pagerdutykey
for the PagerDuty service you have created above, and reference it in PagerDuty Key using an expression. Harness will send notifications using this key.- For example, you can reference a secret within the Org scope using an expression with
org
:
<+secrets.getvalue("org.your-secret-Id")>
- For example, you can reference a secret within the Org scope using an expression with
- Select Finish and your PagerDuty notification is created.
For steps on creating Microsoft Teams notifications, follow the detailed instructions here in Harness Docs.
Currently, this feature is behind the feature flag, PIE_WEBHOOK_NOTIFICATION
. Contact Harness Support to enable the feature.
In Harness you can use webhook notifications to inform an external application of a pipeline/stage event.
In Notification Method, select
Webhook
.In Enter the URL to be called, use expressions to compose the URL to be called when the event occurs. For example,
https://companyurl.notify.com/execution=-<+pipeline.executionId>
.The webhook call is made as a POST request, and includes a JSON object containing the properties of the triggered event.
The expression must be evaluated in the context of the event. For example, stage-related expressions might not be valid for pipeline start events.
- Select Finish and your Webhook notification is created.
Now, in the pipeline, select Run. The pipeline executes and you'll receive notifications on the platform you set up.