"매 fail-fast checkpoint between commit and production". 1990s ISO 9000 의 stage-gate 의 software 의 응용. 매 modern CI/CD 에서 매 PR merge / deploy 의 block 하는 자동 check 의 set. 매 SonarQube 가 popularized — coverage + bugs + smells + security 의 threshold-based gate.
매 핵심
매 layer (commit → prod)
Pre-commit (local): format, lint, secrets scan.
PR gate: build, unit test, coverage, security scan, type check.
Merge gate: full integration test, mutation test (선택).
name:PR Gateon:[pull_request]jobs:test:runs-on:ubuntu-lateststeps:- uses:actions/checkout@v4- uses:astral-sh/setup-uv@v3- run:uv sync- run:uv run pytest --cov=src --cov-report=xml --cov-fail-under=80- run:uv run ruff check .- run:uv run mypy src- uses:codecov/codecov-action@v5security:runs-on:ubuntu-lateststeps:- uses:actions/checkout@v4- uses:aquasecurity/trivy-action@masterwith:{scan-type: fs, severity: 'HIGH,CRITICAL', exit-code:1}- uses:github/codeql-action/init@v3- uses:github/codeql-action/analyze@v3
SonarQube quality gate (Sonar Way)
- Coverage on new code ≥ 80%
- Duplicated lines on new code ≤ 3%
- Maintainability rating on new code = A
- Reliability rating on new code = A
- Security rating on new code = A
- Security hotspots reviewed = 100%
Branch protection (GitHub API)
gh api -X PUT "repos/{owner}/{repo}/branches/main/protection"\
-F required_status_checks[strict]=true\
-F required_status_checks[contexts][]=test\
-F required_status_checks[contexts][]=security \
-F required_pull_request_reviews[required_approving_review_count]=2\
-F enforce_admins=true
Performance budget gate
- name:Bundle size checkrun:| npm run build
SIZE=$(stat -c%s dist/main.js)
if [ $SIZE -gt 250000 ]; then
echo "Bundle exceeds 250KB budget: $SIZE"
exit 1
fi
Mutation testing gate (Stryker / mutmut)
- run:uv run mutmut run- run:| SCORE=$(uv run mutmut results | grep -oP 'killed.*\K\d+')
if [ $SCORE -lt 70 ]; then exit 1; fi
Canary deploy gate
- name:Canary 5%run:kubectl set image deploy/app app=app:${{ github.sha }} --namespace=canary- name:Wait + check SLOrun:| sleep 600
ERROR_RATE=$(prom_query 'rate(http_5xx[10m])')
if (( $(echo "$ERROR_RATE > 0.01" | bc -l) )); then
kubectl rollout undo deploy/app --namespace=canary
exit 1
fi
언제: 매 gate config draft, 매 SonarQube 의 ruleset 의 explain, 매 CI YAML 의 generate.
언제 X: 매 production gate threshold (coverage %, SLO %) — 매 team-context 결정.
❌ 안티패턴
Coverage as only gate: 매 100% coverage + 매 0 assertion 가능. 매 mutation test 의 augment.
Slow gates (>10min): 매 dev velocity kill. 매 parallelize / shard.
Flaky gates: 매 false positive 의 retry-bypass culture. 매 quarantine + fix.
Legacy code 의 same threshold: 매 new-code only 의 ratchet.
Gates without humans: 매 automation alone 의 architectural smell 의 miss.