<@ULVA73B9P> how do I set up an automation based o...
# marvin-in-the-wild
a
@Marvin how do I set up an automation based on deployments with certain tags?
m
You want to automate specific actions based on deployments with certain tags. What version of Prefect are you using?
a
2.18.0
prefect cloud
@Marvin using prefect 2.18.0 and cloud
m
You can set up automations that trigger based on specific tags applied to deployments. Here’s a high-level approach: 1. Create an Automation: Go to the automations page in the Prefect Cloud UI. 2. Set Trigger Type: Select the appropriate trigger type (e.g., deployment, flow run completion). 3. Filter by Tags: Specify the tags you want to filter by. 4. Define Actions: Add actions that should be executed when the trigger conditions are met (e.g., sending notifications, kicking off other deployments). For detailed steps, refer to: - Automations Guide: Automations - Deployment Guide: Deployments These resources should provide the necessary information to configure automations based on deployment tags.
a
@Marvin can you show an example json for an automation that triggers on a flow failure with a tag?
m
Here’s an example JSON configuration for an automation that triggers on a flow failure with a specific tag in Prefect:
Copy code
json
{
  "name": "Flow Failure Notification",
  "trigger": {
    "type": "state",
    "state": "failed",
    "resource": {
      "type": "flow-run",
      "tags": ["important"]
    }
  },
  "actions": [
    {
      "type": "notification",
      "recipient": "<mailto:your-email@example.com|your-email@example.com>",
      "message": "A flow with tag 'important' has failed."
    }
  ]
}
This configuration: 1. Trigger: Watches for
failed
state events on any flow run. 2. Filter: Applies only to flows with the tag
important
. 3. Action: Sends an email notification when the conditions are met. For more details, check out the Automations documentation: Automations.