Green main is a team contract
The single most important cultural rule in CI/CD: do not break main. If main goes red, fixing it is the team's top priority. Not finishing your feature. Not the meeting at 3pm. The build.
This sounds obvious, but it gets violated constantly. The common failures:
- Merging a PR whose CI was green an hour ago, but a different PR landed in between and now the combination breaks (no
strictrequired-status-check). - Bypassing CI with admin powers because 'it's just a doc fix'.
- Letting CI flake (intermittent failures) become the new normal — engineers start ignoring red because 'it'll probably pass on retry'.
- Disabling tests instead of fixing them.
Discipline that keeps main green
- Branch protection: require CI green before merge, require strict (re-run on the new merge base).
- Merge queue: serialize merges so each PR is tested against the actual base it will land on.
- Treat flake as a P0: no test is allowed to fail randomly. Either fix the flake or delete the test — there is no third option.
- 'You break main, you fix main' — the engineer who pushed the broken commit owns the revert or the fast-forward fix, immediately.