Goal
Work with events from a terminal and keep rules in your repository.Prerequisites
- The StackShift CLI, signed in with stackshift auth login.
- For config as code, a stackshift.yaml v2 file.
Workflow
1
Run stackshift events catalog —product hosting to find event types.
2
Run stackshift events tail —type “deploy.*” to watch events live.
3
Run stackshift events subscribe —url https://example.com/hooks/stackshift —type deploy.failed to add a webhook. Copy the signing secret it prints; it is shown once.
4
Add rules under spec.events.rules in stackshift.yaml and deploy.
CLI commands
- tail prints time, type, subject and actor for each event. —type repeats.
- —team takes a team name or id, or personal.
- Rules, destinations and deliveries are managed in the dashboard, the API or stackshift.yaml.
stackshift events
stackshift.yaml
- name is required and unique; it identifies the rule between deploys.
- on takes one or more event patterns.
- where takes conditions on data. Each sets exactly one of is, is_one_of, starts_with or has_value: true.
- to sets exactly one target: function (a function path in this project), webhook (a URL), queue ({ queue, job }), job_event ({ name, correlation_path }), agent (an agent id, or stackie) or notify (a list of in_app, email, slack).
- service names the service when the application has more than one.
- On deploy, StackShift creates and updates rules by name and removes rules you deleted from the file. Rules from the file cannot be edited in the dashboard. A webhook destination created from the file gets a signing secret nobody has seen: use Make a new secret in Destinations to read one.
spec.events.rules
Expected result
Rules from the file show in Events, Rules and stay in step with the file on every deploy.
Related guides
Rules and filters
A rule matches events by type pattern, project, subject and data conditions, then sends each match to one target.
Config as code (stackshift.yaml)
Describe an application in one file in your repository. Every push applies it, every pull request shows a plan, and risky changes wait for you.