Source
id: create-pagerduty-alert-on-failure
namespace: company.team
tasks:
  - id: create_pagerduty_alert
    type: io.kestra.plugin.notifications.pagerduty.PagerDutyExecution
    url: "{{ secret('PAGERDUTY_EVENT') }}"
    payloadSummary: "Kestra Workflow Failure: {{ trigger.executionId }} has failed
      on {{ taskrun.startDate }}"
    deduplicationKey: dedupkey
    routingKey: routingkey
    eventAction: trigger
    executionId: "{{ trigger.executionId }}"
triggers:
  - id: on_failure
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - type: io.kestra.plugin.core.condition.ExecutionStatus
        in:
          - FAILED
          - WARNING
      - type: io.kestra.plugin.core.condition.ExecutionNamespace
        namespace: company
        comparison: PREFIX
About this blueprint
Notifications Kestra
This system flow will create a PagerDuty alert anytime a workflow in a
company namespace (or any nested child namespace) fails.
Using this pattern, you can get alerts for Kestra workflow execution failures alongside other alerts on PagerDuty.
You can customize that system flow by modifying the task, adding more tasks to the flow or adjusting the trigger conditions. Read more about that pattern in the Administrator Guide.
Let's create a flow in the namespace with prefix company that will always
fail.
id: failure_flow
namespace: company.team
tasks:
  - id: always_fails
    type: io.kestra.plugin.core.execution.Fail
Whenever you run the failure_flow, it will trigger an execution of the
create_pagerduty_alert_on_failure flow. As a result, an alert will be
created on PagerDuty so that prompt action can be taken.
More Related Blueprints
