Create and configure triggers
Here are the steps to create and configure triggers via code:- Create a
triggers.yamlfile under your pipeline folder. The file path should bepipelines/[pipeline_uuid]/triggers.yaml. - Enter your trigger configs into the
triggers.yamlfile.- Content structure
- Required trigger fields
name: Unique identifier of the triggerschedule_type:time,api, oreventschedule_interval:@once,@hourly,@daily,@weekly,@monthly,@always_on, or Cron syntax(* * * * *)start_time: The start time of the trigger (e.g.2023-01-01)
- Optional trigger fields
status:activeorinactivevariables: A dictionary of variables that’s associated with the triggersla: SLA in secondssettings: a dictionary of advanced settingsskip_if_previous_running:true/falseallow_blocks_to_fail:true/false
envs: The environments that the trigger runs in. If envs is not set or empty, the trigger will run in all environments. The environment of the Mage app is set viaENVenvironment variable. Supportedenvsvalues:dev,staging,prod,test.
- Content structure
- Save the
triggers.yamlfile. The trigger configs will be synced to the triggers UI shortly.
Example triggers config:
Modify triggers
If an existing trigger is configured in the yaml file, any updates to it through the UI will also update trigger config in the yaml file. If you modify the trigger settings directly in the yaml, it will automatically update the trigger in the UI. The new trigger configs are synced to the triggers in UI.Delete triggers
If you don’t want to use a trigger anymore, you can either update the trigger status toinactive or
delete the trigger completely.
To delete the trigger completely, you can delete the trigger from the UI by clicking the delete button
(with trash can icon) in the Pipeline triggers table (/pipeline/[pipeline_uuid]/triggers). This will
also remove the trigger from the pipeline’s triggers.yaml config file.