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.
The shape
Section titled “The shape”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 --> apiapi.pass --> e2ee2e.pass --> perfperf.pass --> publishunit.fail --> notifyapi.fail --> notifye2e.fail --> notifyperf.fail --> notifyEach 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.
Build it
Section titled “Build it”-
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.
-
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.
-
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.
-
Run it in CI. Save the flow as a template and gate the pipeline on the exit code:
Terminal window flow run quality-gate --jsonsucceededexits0, and any failed stage exits1. The NDJSON stream gives the pipeline per-stage events.flow fmt --checkkeeps the committed.flowfile canonical. -
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.
Optional: AI triage on the failure path
Section titled “Optional: AI triage on the failure path”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}}"}Related
Section titled “Related”- CI integration - exit codes and NDJSON.
- Template Hub - publishing the canonical gate.
- DSL examples - the underlying patterns.