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_guardtừ.gitlab-ci.yml.
Required Project Settings
Vào Project Settings → General → Merge requests và bật:
- Pipelines must succeed = ON
- Only allow merge requests to be merged if all discussions are resolved = ON (khuyến nghị)
Vào Project Settings → Repository → Protected branches:
- Protect branch chính (
mainhoặcmastertheo repo). - Allowed to merge: Maintainers (hoặc role team quy định).
- Allowed to push: No one (MR-only flow).
Required CI Job
- Pipeline phải chứa job
manifest_guardvà job này phảipassedtrước merge. - Nếu
manifest_guardfail 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_guardchạ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(scopeapi). - Run:
cd v2 && npm run verify:gitlab-enforcement
- Expected output: all checks
PASSincluding:- pipeline/discussion merge gates,
- default branch protected,
- push blocked + merge restricted to Maintainers,
manifest_guardjob present in.gitlab-ci.yml.