Customised notification template for Pipeline
Currently this feature is behind Feature Flags PL_CENTRAL_NOTIFICATIONS
, PIPE_CENTRALISED_NOTIFICATION
and PIPE_CUSTOM_NOTIFICATION_TEMPLATES
. You will need all these flags turned on to use this feature. Contact Harness Support to enable them.
Users can now create notification templates, allowing users to customize notification content and reuse templates across multiple pipelines. Templates support Pipeline Expressions, Inputs, and RBAC controls, ensuring flexibility and security.
We are going to discuss about setting up notificatio template for Pipeline at a given scope.
You can set up notification template for Pipeline at following scope: Account, Organization and Project Level.
Setting Up Notifications Template
- Custom Notification template will work only with Centralized Notifications.
- Custom Notification templates will work only for webhook notifications.
- Custom notiification templates don't support usage of template variables
- Interactive guide
- Step-by-step
In this example, we are going to discuss setting up notification template for Pipeline at Project Level:-
- In your Harness, go to your project.
- Select Project Settings, then, under Project-level resources, select Templates.
- Select + New Template, and then select Notifications. The Create New Notifications Template settings open.
- In Name, enter a name for the template.
- (Optional) Select the pencil icon to enter a Description.
- (Optional) Select the pencil icon to add Tags.
- In Version Label, enter the version of the template, for example,
v1
. Versioning a template enables you to create a new template without modifying the existing one. For more information, go to Versioning. - In Text Type you can choose text type HTML, JSON, YAML or String.
- When you select text type as per your need you will be asked to provide the body of notification template.
- Click on Save.
YAML Structure
YAML of notification template will look like:-
template:
name: Notification_template
identifier: Notification_template
versionLabel: v1
type: Notification
projectIdentifier: Krishika_test
orgIdentifier: default
tags: {}
spec:
body:
type: JSON
content: |-
{
"pipeline name" : "<+pipeline.name>",
"stage Name" : "<+stage.name>",
"service Name" : "<+service.name>",
"status" : "<+pipeline.status>"
}