Microsoft Teams Notification
This section describes how to set up and add notification status to Tekton pipelines by sending pipeline status to the Microsoft Teams channel.
Create Incoming WebHook​
To create a link to Incoming Webhook for the Microsoft Teams channel, follow the steps below:
-
Open the channel which will be receiving notifications and click the
•••
button from the upper-right corner. Select Connectors in the dropdown menu: -
In the search field, type Incoming Webhook and click Configure:
-
Provide a name and upload an image for the webhook if necessary. Click Create:
-
Copy and save the unique
WebHookURL
presented in the dialog. ClickDone
: -
Create a secret with the
<WebHookURL>
within the edp namespace.kubectl -n edp create secret generic microsoft-teams-webhook-url-secret \
--from-literal=url=<webhookURL> -
Add the notification task to the pipeline and add the code below in
final-block
in the pipeline and save:{{ include "send-to-microsoft-teams-build" . | nindent 4 }}
Customize Notification Message​
To make notification message informative, relevant text should be added to the message. Here are the steps to implement it:
-
Create a new pipeline with a unique name or modify your custom pipeline created before.
-
Add the task below in the
finally
block with a unique name. Edit theparams.message
value if necessary:
- name: microsoft-teams-pipeline-status-notification-failed
params:
- name: webhook-url-secret
value: microsoft-teams-webhook-url-secret
- name: webhook-url-secret-key
value: url
- name: message
value: >-
Build Failed project: $(params.CODEBASE_NAME)<br /> branch: $(params.git-source-revision)<br /> pipeline: <a href=$(params.pipelineUrl)>$(context.pipelineRun.name)</a><br /> commit message: $(params.COMMIT_MESSAGE)
taskRef:
kind: Task
name: send-to-microsoft-teams
when:
- input: $(tasks.status)
operator: in
values:
- Failed
- PipelineRunTimeout
After customization, the following message is supposed to appear in the channel when failing pipelines: