8

Git 项目仓库中的 OWNERS 文件

 2 years ago
source link: https://forrestsu.github.io/posts/git/git-owners-files-in-repos/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Git 项目仓库中的 OWNERS 文件

2020年5月21日
| 字数 1286
| Git
| 阅读 62

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 文件主要是为了解决代码审查过程中的问题:

  1. 项目中代码审查的速度, 受到能够审查代码的人员数量的限制;
  2. 一个人的代码审查的质量受到他们对所审查代码的熟悉程度的限制。

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 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
  • lreviewers: a list of GitHub usernames or aliases that are good candidates to /lgtm a PR

一个典型的 OWNERS 文件内容如下:

approvers:
  - alice
  - bob     # this is a comment
reviewers:
  - alice
  - carol   # this is another comment
  - sig-foo # this is an alias

4 最佳实践

  • team aliases are used that correspond to sigs
  • reviewers 最好多余 approvers
  • 批准者不在 “reviewers” 区块中
  • OWNERS 文件会定期更新 (至少每次发布变更一次)

Reference

See the OWNERS docs at https://go.k8s.io/owners


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK