DevOps / Gitlab Interview questions
How does GitLab enforce merge request approvals with Code Owners?
A CODEOWNERS file, placed at the repository root, maps file paths or patterns to specific users or groups who must approve any merge request touching those paths. For example, a line like /infra/ @platform-team means any MR that modifies files under /infra/ requires approval from someone on the platform team, regardless of who else has already approved.
This works together with GitLab's approval rules settings (Premium/Ultimate), where a project can require a minimum number of approvals and specifically require Code Owner approval before the merge button becomes available at all. Combined with a protected branch that disallows direct pushes, this means sensitive paths like infrastructure config or security-critical code can't be changed without the right person explicitly signing off, even if the person opening the MR has general write access to the repository.
More Related questions...