How would you design test stages and quality gates in CI/CD?
Answer
Run fast deterministic checks early, broader integration checks after deployable artifacts exist, and targeted end-to-end or non-functional suites where environments support them. A gate needs an owner, reliable signal, failure policy and auditable emergency override.
Strong answer includes
- ordered feedback layers
- reliability before blocking
- explicit override and ownership
Practical example
A pipeline runs unit tests and linting on every commit in under 3 minutes, blocking the merge on failure. After merge to main, a broader integration suite runs against a deployed staging build and gates the promotion to production. A performance suite runs nightly rather than per-commit because it's too slow and slightly flaky to block merges, and a documented emergency-override process lets a director bypass the integration gate for a critical hotfix, with the bypass logged and reviewed the next day.