Git 项目仓库中的 OWNERS 文件
1 Git 在开发中的常用术语
在团队开发过程中,我们经常会看到如下术语(terms),下面记录一下:
| terms | means | 翻译 |
|---|---|---|
| WIP | Work in progress, do not merge yet. | 开发中 |
| LGTM | Looks good to me. | Riview 完别人的 PR,没有问题,可以合并了 |
| PTAL | Please take a look. | 帮我看下,一般都是请别人 review 自己的 PR |
| CC | Carbon copy | 一般代表抄送别人的意思 |
| RFC | request for comments. | 我觉得这个想法很好, 我们来一起讨论下 |
| IIRC | if I recall correctly. | 如果我没记错 |
| ACK | acknowledgement. | 我确认了或者我接受了,我承认了 |
| NACK/NAK | negative acknowledgement. | 我不同意 |
2 OWNERS 文件
k8s 使用 owners 文件的灵感来自于Chromium OWNERS文件
owners 文件主要是为了解决代码审查过程中的问题:
- 项目中代码审查的速度, 受到能够审查代码的人员数量的限制;
- 一个人的代码审查的质量受到他们对所审查代码的熟悉程度的限制。
3 OWNERS
每个包含一个独立代码或内容单元的目录也可能包含一个OWNERS文件。该文件适用于目录中的所有内容,包括OWNERS文件本身,同级文件和子目录。
OWNERS 文件使用 YAML 格式,并且支持如下关键字:
- approvers: 一组Github的用户名或者别名,他们能够
/approve一个 PR - labels: a list of GitHub labels to automatically apply to a PR
- options: a map of options for how to interpret this OWNERS file, currently only one:
- no_parent_owners: defaults to
falseif not present; iftrue, exclude parent OWNERS files. Allows the use case wherea/deep/nested/OWNERSfile preventsa/OWNERSfile from having any effect ona/deep/nested/bit/of/code
- no_parent_owners: defaults to
- lreviewers: a list of GitHub usernames or aliases that are good candidates to
/lgtma PR
一个典型的 OWNERS 文件内容如下:
|
|
4 最佳实践
- team aliases are used that correspond to sigs
- reviewers 最好多余 approvers
- 批准者不在 “reviewers” 区块中
- OWNERS 文件会定期更新 (至少每次发布变更一次)
Reference
See the OWNERS docs at https://go.k8s.io/owners