Blueprints

Create an issue in Linear when a workflow fails

About this blueprint

This system flow will create an issue in Linear anytime a workflow in a company namespace (or any nested child namespace) fails. Using this pattern, you can track your Kestra workflow execution incidents alongside other issues in Linear.

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.

yaml
id: failure_flow
namespace: company.team

tasks:
  - id: always_fails
    type: io.kestra.plugin.scripts.shell.Commands
    commands:
      - exit 1

Whenever you run the failure_flow flow, it will fail. This will result in the triggering of the create_issue_on_failure flow, and it will create the issue in Linear describing the failed flow by its execution ID and start date.

yaml
id: create_ticket_on_failure
namespace: system

tasks:
  - id: linear
    type: io.kestra.plugin.linear.issues.Create
    token: your_api_token
    team: MyTeamName
    title: Workflow failed
    description: "{{ execution.id }} has failed on {{ taskrun.startDate }}. See the link below for more details"
    labels:
      - Bug
      - Workflow
        
triggers:
  - id: on_failure
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - type: io.kestra.plugin.core.condition.ExecutionStatusCondition
        in:
          - FAILED
          - WARNING
      - type: io.kestra.plugin.core.condition.ExecutionNamespaceCondition
        namespace: company
        comparison: PREFIX

Create

Flow

Execution Status Condition

Execution Namespace Condition

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra