Trung BìnhCI/CD iconCI/CD

Build artifact, immutable image, semantic versioning trong CI/CD?

Build once, deploy many: artifact (Docker image, jar, zip) build 1 lần ở stage CI, promote qua các môi trường (dev → staging → prod) — không bao giờ rebuild từ source ở mỗi môi trường. Tại sao immutable: rebuild ở mỗi env risk subtle drift (npm install cùng package.json nhưng khác lockfile resolution, base image cập nhật lén).

  • Image tag bằng commit SHA hoặc semver, không bao giờ overwrite latest cho production. Semantic versioning (semver): MAJOR.MINOR.PATCH — MAJOR khi breaking, MINOR cho feature mới backward-compat, PATCH cho bug fix.
  • Pre-release: 1.2.0-rc.1, 2.0.0-beta.3.
  • Automated tooling: semantic-release (commit message convention feat:, fix:, BREAKING CHANGE: → tự bump version + tạo changelog + tag Git + publish npm). Container image tag strategy: 3 tag cùng lúc — myapp:1.4.2 (semver), myapp:1.4.2-a3f8c9 (semver + commit SHA cho traceability), myapp:latest (chỉ cho dev/staging, không prod). Artifact registry: GitHub Container Registry, AWS ECR, Google Artifact Registry — lưu image với retention policy (xóa image > 30 ngày trừ tagged release). SBOM (Software Bill of Materials): generate khi build (syft hoặc cosign), lưu cùng artifact để audit compliance và detect vulnerable dependency sau publish.

Xem toàn bộ CI/CD cùng filter theo level & chủ đề con.

Mở danh sách CI/CD