Job dependencies & failure gates
Stop delivery when tests fail
Lesson 4 of 20 · 12 min · Module 2: Gates and build outputs
A failed prerequisite should block the change that depends on it.
Start this lesson →Free. No installation: you write and run the code in your browser, and it is checked automatically.
By the end, you’ll be able to…
- Model the safety dependency
- Preserve failure as a useful signal
The idea
A workflow combines an event boundary, job dependencies, and ordered steps. Conditions and prerequisite outcomes determine which jobs can run.
jobs:
check:
runs-on: ubuntu-latest
steps: [{run: npm test}]
package:
needs: check
runs-on: ubuntu-latest
steps: [{run: npm run build}]
01Model the safety dependency
A deployment should depend on the checks that justify it. Writing jobs in a particular order is not the same as declaring needs.
02Preserve failure as a useful signal
If tests fail, suppressing the error makes the pipeline tell a misleading story. The lab deliberately supplies a failing test outcome.
03Inspect what did not happen
The expected result is a failed test job and a skipped deploy job, with no new deployment recorded. A skipped unsafe action is successful gating.
Your turn
What the checks look for
- Records the failing test
- Blocks deployment through needs
Take this with you
Treat the absence of an unsafe deployment as a behavior worth testing.
Go a little further
Change the lab test outcome and predict which jobs become eligible.