CODEOWNERS and Bazel
Blog post from Aspect Build
Managing code reviews and ownership in monorepos is complex, with the common use of GitHub's CODEOWNERS file proving insufficient due to its single-file constraint that doesn't cater well to multiple organizational needs. The monorepo build tool, Bazel, is mentioned as related but not ideal for handling such "whole-repo operations" because of its dependency graph limitations. Alternatives like rules_codeowners attempt to layer ownership on top of Bazel's graph but introduce inefficiencies by requiring large registration blocks that slow down builds due to unnecessary dependency fetching. Google's approach with a separate OWNERS file and Kubernetes' similar method are highlighted as more effective, as they maintain ownership semantics without involving Bazel. A more flexible solution is proposed, where ownership changes are treated as a continuous delivery problem, allowing updates to OWNERS files to be merged and reflected in CODEOWNERS only after they are committed to the main branch, ensuring that required reviews are conducted before ownership modifications take effect.