Part 13 · CI/CD, Git & Cloud

CI/CD và microservice deployment: execution labs

Build once/promote, independent service rollout và schema evolution phải chịu được mixed versions, failed migration và rollback.

Lab A · Verified immutable artifact

  1. Pipeline compile/unit/integration/contract/scan/SBOM/sign/publish.
  2. Tag artifact bằng commit nhưng deploy theo immutable digest.
  3. Promote cùng digest dev→staging→production; không rebuild per environment.
  4. Chạy untrusted PR scenario; assert không có production secret/write credential.

Lab B · Expand–migrate–contract

A: add nullable total_amount
B: deploy code read-old/new and compatible writes
M: backfill batches with checkpoint
C: switch reads using flag, reconcile
D: drop old column after rollback window
  1. Chạy v1/v2 cùng schema; assert cả hai hoạt động.
  2. Inject migration fail ở batch 3; resume từ checkpoint.
  3. Canary v2 write new format rồi rollback; xác nhận v1 vẫn đọc được.
  4. Chạy contract sớm trong test để tái hiện old-pod failure.

Lab C · Independent multi-service release

  1. Inventory v2 thêm reservation endpoint nhưng giữ v1 API.
  2. Order v2 deploy flag off; consumer/provider contracts chạy trước deploy.
  3. Canary flag 1%→10%→100%, gate errors/latency/reservation leaks.
  4. Telemetry xác nhận old endpoint không còn caller rồi mới deprecate/contract.

Lab D · Terraform delivery

  1. fmt, validate, lint/security/policy và reviewed plan.
  2. Remote encrypted/versioned state + locking; short-lived OIDC identity.
  3. Inject apply partial failure; refresh/plan và recover without manual blind edits.
  4. Simulate drift/import/state move trong sandbox fixture.

Deliverables

Execution evidence gate

  1. Ghi runtime/version, input và hypothesis trước khi chạy; lưu command, config, request ID và raw output.
  2. Inject failure tại checkpoint xác định và assert invariant từ nguồn độc lập.
  3. Chạy matrix phù hợp: timing, concurrency, dependency, lifecycle và mixed-version compatibility.
  4. Kết luận bằng mechanism, trade-off, limitation, recovery/rollback và production decision.
Completion: phân biệt specified, executed, explainedproduction-ready evidence. Không đánh dấu executed nếu snippet hoặc code chưa thực sự được chạy.