Source
id: flow-condition-executionlabels
namespace: company.team
tasks:
- id: send_email
type: io.kestra.plugin.notifications.mail.MailExecution
to: [email protected]
from: [email protected]
subject: "The workflow execution {{ trigger.executionId }} failed for the flow
{{ trigger.flowId }} in the namespace {{ trigger.namespace }}"
host: mail.privateemail.com
port: 465
username: "{{ secret('EMAIL_USERNAME') }}"
password: "{{ secret('EMAIL_PASSWORD') }}"
executionId: "{{ trigger.executionId }}"
triggers:
- id: flow_trigger
type: io.kestra.plugin.core.trigger.Flow
conditions:
- type: io.kestra.plugin.core.condition.ExecutionLabels
labels:
owner: john.doe
states:
- FAILED
About this blueprint
Trigger
This flow trigger executes the flow based on the ExecutionLabels condition. When any flow with the labels as specified under the labels
in the ExecutionLabels condition enters into the state specified under the states
attribute, this flow will get triggered.
In this case, when any flow with label owner: john.doe
enters the FAILED
state as defined in the states
attribute, this flow will get triggered. This flow will send an email about the flow execution that has failed, and in turn resulted in the triggering of this flow.
With ExecutionLabels condition, you can enforce the condition on flow trigger that is based on labels of another flow.
More Related Blueprints