Skip to content

Branch Protection Policy (GitLab)

Context

  • Repository remote hiện tại: GitLab (origin = gitlab.pconnect.vn).
  • Job bắt buộc để bảo vệ docs/code truth: manifest_guard từ .gitlab-ci.yml.

Required Project Settings

Vào Project Settings → General → Merge requests và bật:

  1. Pipelines must succeed = ON
  2. Only allow merge requests to be merged if all discussions are resolved = ON (khuyến nghị)

Vào Project Settings → Repository → Protected branches:

  1. Protect branch chính (main hoặc master theo repo).
  2. Allowed to merge: Maintainers (hoặc role team quy định).
  3. Allowed to push: No one (MR-only flow).

Required CI Job

  • Pipeline phải chứa job manifest_guard và job này phải passed trước merge.
  • Nếu manifest_guard fail thì MR không được merge.

Validation Checklist

  • [ ] Mở MR test có sửa schema/entity hoặc scripts và xác nhận manifest_guard chạy.
  • [ ] Xác nhận merge button bị khóa khi job fail.
  • [ ] Xác nhận merge button mở lại khi job pass.

Operational Command (local parity)

  • cd v2 && npm run ci:manifest-guard

One-Command Enforcement Verification

  • Prerequisite: set GITLAB_TOKEN (scope api).
  • Run:
    • cd v2 && npm run verify:gitlab-enforcement
  • Expected output: all checks PASS including:
    • pipeline/discussion merge gates,
    • default branch protected,
    • push blocked + merge restricted to Maintainers,
    • manifest_guard job present in .gitlab-ci.yml.

FitZalo Platform Documentation