Update _index.md

This commit is contained in:
Denise
2019-03-22 10:06:33 -07:00
committed by Denise Schannon
parent 65b77b0136
commit 50d9b88c27
@@ -477,26 +477,40 @@ branch:
### Configuring Notifications
You can configure pipelines to send notifications to [notifiers](https://rancher.com/docs/rancher/v2.x/en/tools/notifiers-and-alerts/#notifiers) when an execution is finished.
You can configure pipelines to send out notifications to any [notifiers]({{< baseurl >}}/rancher/v2.x/en/tools/notifiers-and-alerts/#notifiers) based on the build status of a pipeline. Before configuring a notification, Rancher recommends [setting up notifiers]]({{< baseurl >}}/rancher/v2.x/en/tools/notifiers-and-alerts/#adding-notifiers) so it will be easy to add recipients immediately.
> **Note:** Notifiers are configured at a cluster level, but pipelines are configured at the project level.
{{% tabs %}}
{{% tab "By UI" %}}
1. From the context menu, open the project for which you've configured a pipeline. Then select the **Pipelines** tab.
1. Find the pipline that you want to add a notification to, by opening the **Pipelines** tab in your project.
1. From the pipeline for which you want to edit the timeout, select **Ellipsis (...) > Edit Config**.
1. From the pipeline for which you want to add notifications, select **Ellipsis (...) > Edit Config**.
1. Enable the **Notification** option.
1. Within the **Notification** section, select **Enable**.
1. Select conditions for notifications. For example, if you want to receive notifications when on execution failure, select **Failed**.
1. Select the conditions for the notification. You can select to get a notification for the following statuses: `Failed`, `Success`, `Changed`. For example, if you want to receive notifications when an execution fails, select **Failed**.
1. If you don't have any existing notifier, click **create one** and you will be directed to the notifiers page. Follow the [instruction](https://rancher.com/docs/rancher/v2.x/en/tools/notifiers-and-alerts/#adding-notifiers) to add a notifier. If you have already configured notifiers, click **Add Recipient** button.
1. If you don't have any existing [notifiers]({{< baseurl >}}/rancher/v2.x/en/tools/notifiers-and-alerts/#notifiers), Rancher will provide a warning that no notifers are set up and provide a link to be able to go to the notifiers page. Follow the [instructions]({{< baseurl >}}/rancher/v2.x/en/tools/notifiers-and-alerts/#adding-notifiers) to add a notifier. If you already have notifiers, you can add them to the notification by clicking **Add Recipient** button.
1. Select a notifier from the dropdown, then input recipient or use the default one. By clicking the **Add Recipient** button, you can send notifications to different notifiers or multiple recipients.
1. For each recipient, select which notifier from the dropdown. Based on the type of notifier, you can use the default setting or override it with a different value. For example, if you have a notifier for Slack, you can update which channel to send the notification to. You can add additional notifiers by clicking **Add Recipient**.
{{% /tab %}}
{{% tab "By YAML" %}}
You can add notifiers directly in the `.rancher-pipeline.yml` file.
Under the `notification` section, you will provide the following information:
* Recipients: This will be the list of notifiers/recipients that will receive the notification.
* Notifier: The ID of the notifier. This can be found by finding the notifier and selecting **View in API** to get the ID.
* Recipient: Depending on the type of the notifier, the "default recipient" can be used or you can override this with a different recipient. For example, when configuring a slack notifier, you select a channel as your default recipient, but if you wanted to send notifications to a different channel, you can select a different recipient.
* Condition: Select which conditions of when you want the notification to be sent.
* Message (Optional): If you want to change the default notification message, you can edit this in the yaml. Note: This option is not available in the UI,
```yaml
# example
# Example
stages:
- name: Build something
steps:
@@ -505,13 +519,15 @@ stages:
shellScript: ls
notification:
recipients:
- recipient: "#mychannel"
# notifier name or id
- # Recipient
recipient: "#mychannel"
# Name or ID of Notifier
notifier: "my-slack-notifier"
- recipient: "test@example.com"
notifier: "my-email-notifier"
condition: ["Failed"]
# optional message that overrides the default message
# Select which statuses you want the notification to be sent
condition: ["Failed", "Success", "Changed"]
# Ability to override the default message (Optional)
message: "my-message"
```
{{% /tab %}}