Skip to content

Tutorial: quality gate

This tutorial builds the canonical quality gate from the quality-gates case study. It is one versioned, shareable flow that runs the same stages the same way on every change. The gate stops depending on who set it up.

flow "quality-gate" v1
unit[action: "Unit tests"] {
adapter: "shell"
actionId: "pnpm"
args: "test"
}
api[action: "Component and API tests"] {
adapter: "shell"
actionId: "run-command"
command: "pnpm run test:api"
}
e2e[action: "UI e2e"] {
adapter: "shell"
actionId: "run-command"
command: "pnpm exec playwright test"
}
perf[action: "Performance"] {
adapter: "shell"
actionId: "run-command"
command: "sh scripts/perf-gate.sh"
}
publish[action: "Publish results"] {
adapter: "shell"
actionId: "curl"
args: "-fsS -X POST https://dashboard.example.com/api/results"
}
notify[action: "Notify on failure"] {
adapter: "shell"
actionId: "curl"
args: "-fsS -X POST https://hooks.example.com/quality-alert"
}
unit.pass --> api
api.pass --> e2e
e2e.pass --> perf
perf.pass --> publish
unit.fail --> notify
api.fail --> notify
e2e.fail --> notify
perf.fail --> notify

Each stage gates the next on pass, and any failure routes to the notify branch. Substitute your real runners. The tools are node data, not platform code.

  1. Compose the stages. Drag Shell action nodes for each stage. Keep one stage per node so the canvas (and History) shows exactly which stage broke.

  2. Wire the gates. Connect stages with pass edges. Fan every stage’s fail edge into the notify node. The notify node is reached only via fail edges, so a green run sends nothing.

  3. Trigger on commit or PR. Use a CLI-preset node (for example a GitHub Command node) at the head to react to repository state, or run the gate from CI with the headless runner (next step) and let the pipeline trigger it.

  4. Run it in CI. Save the flow as a template and gate the pipeline on the exit code:

    Terminal window
    flow run quality-gate --json

    succeeded exits 0, and any failed stage exits 1. The NDJSON stream gives the pipeline per-stage events. flow fmt --check keeps the committed .flow file canonical.

  5. Publish, don’t improvise. Save the flow as a template and share it. Teams clone the gate instead of re-wiring their own. Updates to the canonical gate propagate by cloning the new version. The know-how is captured in the flow, not in a person.

Add an ai node after notify (reached via the same fail branch) that summarizes the failing stage’s output. It uses local inference, so test output never leaves the machine:

triage[ai: "Triage failure"] {
modelId: "local-llm"
input: "Summarise why this quality stage failed in two sentences: {{input}}"
}