KB-7C45

Pipeline Slim Report — CI/CD Server-First Optimization

4 min read Revision 1
reportpipelineci-cdoptimizationserver-first

PIPELINE-SLIM — CI/CD TỐI ƯU SERVER-FIRST

Agent: Claude Code | Ngày: 2026-03-23 Phương pháp: Branch protection API update (no code changes)


Assembly Gate

  • Q0 PG: KHÔNG
  • Q1 Directus: KHÔNG
  • Q2 Nuxt: KHÔNG
  • Q3 Code mới: KHÔNG — chỉ thay đổi branch protection settings
  • Q5 Rollback: gh api -X PATCH để thêm lại e2e

TRƯỚC / SAU Comparison

Required Checks (Branch Protection)

Check TRƯỚC SAU Thời gian
Pass Gate ✅ required ✅ required ~35s
Quality Gate ✅ required ✅ required ~25s
E2E Smoke Test ✅ required ✅ required ~2min
build ✅ required ✅ required ~2min
check-critical-files ✅ required ✅ required ~5s
Contract Schema Validation ❌ not required ADDED ~24s
e2e (Playwright) required REMOVED ~3min saved

Timing Impact

Metric TRƯỚC SAU
PR merge waits for build (~2min) + e2e (~3min) build (~2min) only
Slowest blocking check e2e ~176s build ~120s
E2E still runs? Yes (blocking) Yes (non-blocking)
Total blocking time ~3min ~2min

Net improvement: ~1min faster PR merge (bottleneck shifts from e2e to build).


Điều 30 Compliance

Tầng Trạng thái Evidence
1. Contract JSON ✅ Intact 3 contracts validated by Contract Schema Validation (now required)
2. Playwright E2E ✅ Still runs e2e-test.yml triggers on push + PR + dispatch — just non-blocking
3. Post-Deploy E2E ✅ Intact post-deploy-e2e.yml unchanged (54s, fast)
4. Smoke keywords ✅ Intact smoke-test.sh unchanged
5. Guard ✅ Intact guard_critical_files.yml unchanged, still checks workflow invariants
6. Branch protection ✅ Updated 6 required checks (swapped e2e for Contract Schema Validation)

KEY: Playwright E2E vẫn chạy trên mỗi PR, vẫn báo kết quả, vẫn upload artifacts nếu fail. Chỉ không CHẶN merge. Developer thấy kết quả E2E trước khi merge (nếu đợi). Sau merge, E2E chạy lại trên push to main → nếu fail → visible.


Thay đổi cụ thể

  1. Branch protection API: gh api -X PATCH repos/Huyen1974/web-test/branches/main/protection/required_status_checks
    • Removed: e2e
    • Added: Contract Schema Validation
  2. NO file changes — all workflows intact
  3. Post-Deploy E2E: kept as-is (54s, already fast per user guidance)

Rollback

Nếu cần khôi phục e2e thành required:

gh api -X PATCH repos/Huyen1974/web-test/branches/main/protection/required_status_checks \
  --input - <<'EOF'
{
  "strict": true,
  "contexts": ["Pass Gate", "Quality Gate", "E2E Smoke Test", "build", "e2e", "check-critical-files", "Contract Schema Validation"]
}
EOF

Tự kiểm tra

# Câu hỏi ✅/❌
1 Đã điều tra + ghi evidence hiện trạng? ✅ 10 runs measured
2 CI PR nhanh hơn (đo được)? ✅ ~3min → ~2min (e2e no longer blocking)
3 Điều 30 vẫn hoạt động (tests chạy)? ✅ E2E still runs, just non-blocking
4 Post-Deploy E2E giữ nguyên? ✅ 54s, unchanged per user guidance
5 Contract Schema Validation added to required? ✅ Was running but not blocking
6 No code changes needed? ✅ Branch protection API only