As part of TF evolution and maturity we would need to establish a governance and administration model for code contribution, review and approval process for lock free, escalation and resolution pipelines. While we have identified a structure for contributors and leads for the modules, we have to define how the leads can nominate themselves or their team member with expertise in the module to be the owner / co-owner to approve a pull request.
While I studied some of the open source projects for the model, I liked what is being implemented in Kubernetes. They use the concept of owners and reviewers.
Reviewers - A group of experts for a components and/or module
Owners - A group of experts for module and/or overall architecture of the system
The nice thing about the way it is implemented is that the details of group alias for each module is also code driven by the OWNERS file.
OWNERS files are used to designate responsibility over different parts of the Kubernetes codebase. Today, it is used to assign the reviewer and approver roles that are used in our two-phase code review process.
The velocity of a project that uses code review is limited by the number of people capable of reviewing code. The quality of a person's code review is limited by their familiarity with the code under review. Kubernetes addresses both of these concerns through the prudent use and maintenance of OWNERS files.
The https://github.com/kubernetes/test-infra/blob/master/prow/repoowners/repoowners.go is the main consumer of OWNERS files.
Each directory that contains a unit of independent code or content may also contain an OWNERS file. This file applies to everything within the directory, including the OWNERS file itself, sibling files, and child directories.
OWNERS files are in YAML format and support the following keys:
approvers
: a list of GitHub usernames or aliases that can /approve
a PRlabels
: a list of GitHub labels to automatically apply to a PRoptions
: a map of options for how to interpret this OWNERS file, currently only one:no_parent_owners
: defaults to false
if not present; if true
, exclude parent OWNERS files. Allows the use case where a/deep/nested/OWNERS
file prevents a/OWNERS
file from having any effect on a/deep/nested/bit/of/code
reviewers
: a list of GitHub usernames or aliases that are good candidates to /lgtm
a PR The above keys constitute a simple OWNERS configuration.
All users are expected to be assignable. In GitHub terms, this means they must be members of the organization to which the repo belongs.
A typical OWNERS file looks like:
approvers: - Ed - Xu reviewers: - Peter - Chandra - config # this is an alias
It is inevitable, but there are times when someone may shift focuses, change jobs or step away from a specific area in the project for a time. These people may be domain experts over certain areas of the codebase, but can no longer dedicate the time needed to handle the responsibilities of reviewing and approving changes. They are encouraged to add themselves as an "emeritus" approver under the emeritus_approvers
key.
GitHub usernames listed under the emeritus_approvers
key can no longer approve code (use the /approve
command) and will be ignored by prow for assignment. However, it can still be referenced by a person looking at the OWNERS file for a possible second or more informed opinion.
When a contributor returns to being more active in that area, they may be promoted back to a regular approver at the discretion of the current approvers.
emeritus_approvers: - david # 2018-05-02 - emily # 2019-01-05
Each repo may contain at its root an OWNERS_ALIAS file.
OWNERS_ALIAS files are in YAML format and support the following keys:
aliases
: a mapping of alias name to a list of GitHub usernamesWe use aliases for groups instead of GitHub Teams, because changes to GitHub Teams are not publicly auditable.
A sample OWNERS_ALISES file looks like:
aliases: config: - Ignatious Johnson - Nagendra vrouter: - Kiran KN - Anand
GitHub usernames and aliases listed in OWNERS files are case-insensitive.
This is a simplified description of our full PR testing and merge workflow that conveniently forgets about the existence of tests, to focus solely on the roles driven by OWNERS files. Please see below for details on how specific aspects of this process may be configured on a per-repo basis.
/lgtm
in a PR comment or review; if they change their mind, they /lgtm cancel
/lgtm
'ed, an lgtm
label to the PR/assign
's all suggested approvers to the PR, and optionally notifies them (eg: "pinging @foo for approval")/approve
in a PR comment or review; if they change their mind, they /approve cancel
approved
labellgtm
, approved
)do-not-merge/hold
, needs-rebase
)OWNERS files should be regularly maintained.
We should encourage people to self-nominate, self-remove or switch to emeritus from OWNERS files via PR's. Ideally in the future we could use metrics-driven automation to assist in this process.
We should strive to:
Technical Steering committee should act as escalation point for mediating and ensure timely resolution of a blocked state on a PR.