Skip to content

Commit

Permalink
docs: add prow plugins document (#466)
Browse files Browse the repository at this point in the history
part of #423

close #426
close #408
close #465
  • Loading branch information
634750802 authored Apr 9, 2021
1 parent 85f0430 commit 561b478
Show file tree
Hide file tree
Showing 12 changed files with 384 additions and 31 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
| ti-community-label | 外部插件 | 通过命令为 PR 或 Issue 添加标签。 |
| ti-community-label-blocker | 外部插件 | 主要负责阻止用户对某些敏感标签的进行非法操作。 |
| ti-community-label-contribution | 外部插件 | 主要负责为外部贡献者的 PR 添加 `contribution``first-time-contributor` 标签。 |
| need-rebase | 外部插件 | 当 PR 需要进行 rebase 时,通过添加标签或添加评论提醒 PR 作者进行 rebase。 |
| needs-rebase | 外部插件 | 当 PR 需要进行 rebase 时,通过添加标签或添加评论提醒 PR 作者进行 rebase。 |
| require-matching-label | 内置插件 | 当 PR 或 Issue 缺失相关标签时,通过添加标签或评论提醒贡献者进行补充。 |
| hold | 内置插件 | 通过 `/[un]hold` 命令,添加或取消 PR 的不可合并状态。 |
| assign | 内置插件 | 通过 `/[un]assign` 命令,添加或取消 PR 或 Issue 的 assignee。 |
Expand Down
28 changes: 17 additions & 11 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
- [基础组件](components.md)
- [Tide](components/tide.md)
- [插件](plugins.md)
- [ti-community-owners](plugins/owners.md)
- [ti-community-lgtm](plugins/lgtm.md)
- [ti-community-merge](plugins/merge.md)
- [ti-community-tars](plugins/tars.md)
- [ti-community-blunderbuss](plugins/blunderbuss.md)
- [ti-community-label](plugins/label.md)
- [ti-community-label-blocker](plugins/label-blocker.md)
- [ti-community-contribution](plugins/contribution.md)
- [require-matching-label](plugins/require-matching-label.md)
- [hold](plugins/hold.md)
- [wip](plugins/wip.md)
- 外部插件
- [ti-community-owners](plugins/owners.md)
- [ti-community-lgtm](plugins/lgtm.md)
- [ti-community-merge](plugins/merge.md)
- [ti-community-tars](plugins/tars.md)
- [ti-community-blunderbuss](plugins/blunderbuss.md)
- [ti-community-label](plugins/label.md)
- [ti-community-label-blocker](plugins/label-blocker.md)
- [ti-community-contribution](plugins/contribution.md)
- [needs-rebase](plugins/needs-rebase.md)
- 内置插件
- [require-matching-label](plugins/require-matching-label.md)
- [hold](plugins/hold.md)
- [wip](plugins/wip.md)
- [size](plugins/size.md)
- [assign](plugins/assign.md)
- [milestone](plugins/milestone.md)
- [工具](tools.md)
- [label_sync](tools/label_sync.md)
- [autobump](tools/autobump.md)
Expand Down
16 changes: 8 additions & 8 deletions docs/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ The following shows some commonly used components or plugins in the TiDB communi
| ti-community-label | external plugin | Add labels to PR or Issue via commands. |
| ti-community-label-blocker | external plugin | Mainly responsible for preventing users from illegal operations on certain sensitive labels. |
| ti-community-contribution | external plugin | Mainly responsible for adding `contribution` or `first-time-contributor` labels to the PRs of external contributors. |
| need-rebase | external plugin | When the PR needs to rebase, add labels or add comments to remind the PR author to rebase. |
| require-matching-label | external plugin | When a PR or Issue lacks a relevant label, add a label or comment to remind contributors to supplement. |
| hold | external plugin | Add or cancel the non-combinable status of PR through the `/[un]hold` command. |
| assign | external plugin | Add or cancel the assignee of PR or Issue through the `/[un]assign` command. |
| size | external plugin | Evaluate the size of the PR based on the number of lines of code modification, and label the PR with `size/*`. |
| lifecycle | external plugin | Use labels to mark the life cycle of Issue or PR. |
| wip | external plugin | Add the `do-not-merge/work-in-progress` label to the PR under development to prevent the automatic assignment of reviewer and PR merge. |
| welcome | external plugin | Send a welcome message to contributors who have contributed for the first time through a robot. |
| needs-rebase | external plugin | When the PR needs to rebase, add labels or add comments to remind the PR author to rebase. |
| require-matching-label | internal plugin | When a PR or Issue lacks a relevant label, add a label or comment to remind contributors to supplement. |
| hold | internal plugin | Add or cancel the non-combinable status of PR through the `/[un]hold` command. |
| assign | internal plugin | Add or cancel the assignee of PR or Issue through the `/[un]assign` command. |
| size | internal plugin | Evaluate the size of the PR based on the number of lines of code modification, and label the PR with `size/*`. |
| lifecycle | internal plugin | Use labels to mark the life cycle of Issue or PR. |
| wip | internal plugin | Add the `do-not-merge/work-in-progress` label to the PR under development to prevent the automatic assignment of reviewer and PR merge. |
| welcome | internal plugin | Send a welcome message to contributors who have contributed for the first time through a robot. |
| label_sync | tool | Able to synchronize the labels configured in the yaml file to one or more repositories. |
| autobump | tool | Update the version of upstream Prow and its related components and plugins by automatically submitting Pull Requests. |

Expand Down
28 changes: 17 additions & 11 deletions docs/en/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
- [Components](en/components.md)
- [Tide](en/components/tide.md)
- [Plugins](en/plugins.md)
- [ti-community-owners](en/plugins/owners.md)
- [ti-community-lgtm](en/plugins/lgtm.md)
- [ti-community-merge](en/plugins/merge.md)
- [ti-community-tars](en/plugins/tars.md)
- [ti-community-blunderbuss](en/plugins/blunderbuss.md)
- [ti-community-label](en/plugins/label.md)
- [ti-community-label-blocker](en/plugins/label-blocker.md)
- [ti-community-contribution](en/plugins/contribution.md)
- [require-matching-label](en/plugins/require-matching-label.md)
- [hold](en/plugins/hold.md)
- [wip](en/plugins/wip.md)
- External
- [ti-community-owners](en/plugins/owners.md)
- [ti-community-lgtm](en/plugins/lgtm.md)
- [ti-community-merge](en/plugins/merge.md)
- [ti-community-tars](en/plugins/tars.md)
- [ti-community-blunderbuss](en/plugins/blunderbuss.md)
- [ti-community-label](en/plugins/label.md)
- [ti-community-label-blocker](en/plugins/label-blocker.md)
- [ti-community-contribution](en/plugins/contribution.md)
- [needs-rebase](en/plugins/needs-rebase.md)
- Internal
- [require-matching-label](en/plugins/require-matching-label.md)
- [hold](en/plugins/hold.md)
- [wip](en/plugins/wip.md)
- [size](en/plugins/size.md)
- [assign](en/plugins/assign.md)
- [milestone](en/plugins/milestone.md)
- [tools](tools.md)
- [label_sync](en/tools/label_sync.md)
- [autobump](en/tools/autobump.md)
Expand Down
35 changes: 35 additions & 0 deletions docs/en/plugins/assign.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# assign

## Design Background

Collaborating on a large repository requires assigning PRs or issues to specific collaborators to follow up on, but without write access, you can't assign them directly through the GitHub page.

[assign](https://github.com/kubernetes/test-infra/tree/master/prow/plugins/assign) provides a command that allows the bot to assign collaborators and request reviewers.

## Design

The plugin was designed and developed by the Kubernetes community and provides two commands:

- `/[un]assign @someone hi-rustin`: assign or un-assign Issue/PR to someone and hi-rustin.
- `/[un]cc @someone hi-rustin`: request or un-request someone and hi-rustin to review PR.

Note: If you do not specify a GitHub account after the command, it defaults to yourself.

## Parameter Configuration

No configuration

## Reference documentations

- [command help](https://prow.tidb.io/plugins?repo=ti-community-infra%2Ftichi)
- [code](https://github.com/kubernetes/test-infra/tree/master/prow/plugins/assign)

## Q&A

### Why do you support usernames that do not start with `@`?

> https://github.com/ti-community-infra/tichi/issues/426
When starting with `@`, GitHub automatically sends an email to the corresponding user. Another notification email will send by the bot when the user has been assigned, or requested to review.
To reduce the number of unnecessary emails, `assign` allows usernames that do not start with `@`.

53 changes: 53 additions & 0 deletions docs/en/plugins/milestone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# milestone

## Design Background

On large repositories we use milestones to track the progress of PRs and Issues, but GitHub restricts the ability to add milestones to Issues/PRs to collaborators with write access.

[milestone](https://github.com/kubernetes/test-infra/tree/master/prow/plugins/milestone) provides a command that allows the bot to add the corresponding milestone.

## Permissions Design

This plugin is primarily responsible for adding milestones, so only the milestone management team can use this command.

## Design

The plugin was designed and developed by the Kubernetes community and provides two commands.

- `/milestone v1.3.2 v1.4` adds milestone v1.3.2 and v1.4.
- `/milestone clear` clears all milestones on Issue/PR.

Note: Only the milestone management team can use this command.

## Parameter Configuration

| Parameter Name | Type | Description |
| ------------------------- | ------ | ---------------- |
| maintainers_id | int | GitHub Team ID |
| maintainers_team | string | GitHub team name |
| maintainers_friendly_name | string | Team nickname |

For example:

```yaml
repo_milestone:
ti-community-infra/test-dev:
maintainers_id: 4300209
maintainers_team: bots-maintainers
maintainers_friendly_name: Robots Maintainers
```
## Reference documents
- [command help](https://prow.tidb.io/plugins?repo=ti-community-infra%2Ftichi)
- [code](https://github.com/kubernetes/test-infra/tree/master/prow/plugins/milestone)
## Q&A
### How can I get my GitHub Team ID?
```sh
curl -H "Authorization: token <token>" "https://api.github.com/orgs/<org-name>/teams?page=N"
```
The above API allows you to get the details of all GitHub teams under that organization.
33 changes: 33 additions & 0 deletions docs/en/plugins/needs-rebase.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# needs-rebase

## Design Background

GitHub doesn't usually alert PR authors to resolve PR conflicts, which can result in our PR not being automatically merged by the bot and requiring to alert them manually to resolve the conflict. Also, we can't see which one have conflicts in the PRs list.

[needs-rebase](https://github.com/kubernetes/test-infra/tree/master/prow/external-plugins/needs-rebase) can periodically check for conflicts in PR by adding the `needs-rebase` label and remind PR authors to resolve conflicts.

## Design

This plugin was designed and developed by the Kubernetes community. They implemented it with the idea that not only should all PRs be scanned periodically to add or remove `needs-rebase` label, but also that those PRs that are active and have replies should have `needs-rebase` label added as soon as possible to remind them to resolve conflicts.

## Parameter Configuration

No configuration

## Reference documents

- [command help](https://prow.tidb.io/plugins?repo=ti-community-infra%2Ftichi)
- [code](https://github.com/kubernetes/test-infra/tree/master/prow/external-plugins/needs-rebase)

## Q&A

### Is it disturbing to PR authors that the bot comments while adding `needs-rebase` label?

> https://github.com/ti-community-infra/tichi/issues/408
This is because GitHub doesn't alert you when a PR conflict has occurred, and GitHub doesn't notify you when a bot adds `needs-rebase`, so we have to explicitly notify you via a reply.
Also, **after you resolve the conflict the bot automatically removes the `needs-rebase` label and deletes the outdated and useless replies. **

### How often are scans performed?

The automatic scan is performed once every 24 hours.
50 changes: 50 additions & 0 deletions docs/en/plugins/size.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# size

## Design Background

In the GitHub PR list, we don't directly know the size of the PR code changes (the number of lines added or removed). However, we sometimes schedule our reviews based on the size of the changes.

[size](https://github.com/kubernetes/test-infra/tree/master/prow/plugins/size) adds a size label to the PR based on the number of lines added or deleted to the PR code.

## Design

This plugin was designed and developed by the Kubernetes community, and it's implementation is very simple. size adds `size/*` labels to a PR by detecting the number of lines added or deleted by the PR, and each size label has a range of lines corresponding to.

- `size/XS`: 0-9
- `size/S`: 10-29
- `size/M`: 30-89
- `size/L`: 89-269
- `size/XL`: 270-519
- `size/XXL`: 520+

## Parameter Configuration

| Parameter Name | Type | Description |
| -------------- | ---- | ----------------------------- |
| s | int | size/S number of rows |
| m | int | size/M number of rows |
| l | int | number of rows for size/L |
| xl | int | The number of rows in size/XL |
| xxl | int | size/XXL rows |

For example:

```yaml
size:
s: 10
m: 30
l: 100
xl: 500
xxl: 1000
```
## Reference Documents
- [command help](https://prow.tidb.io/plugins?repo=ti-community-infra%2Ftichi)
- [code](https://github.com/kubernetes/test-infra/tree/master/prow/plugins/size)
## Q&A
### Will it automatically add and remove `size/*` labels when I change my PR?

Yes, it will dynamically add and remove labels based on code changes.
34 changes: 34 additions & 0 deletions docs/plugins/assign.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# assign

## 设计背景

在大型仓库上协作需要将 PR 或 Issue 分配给特定的协作者来跟进,但是如果没有写权限,是无法直接通过 GitHub 页面去分配的。

[assign](https://github.com/kubernetes/test-infra/tree/master/prow/plugins/assign) 可以提供命令让机器人帮助我们分配协作者和请求 reviewer。

## 设计思路

该插件由 Kubernetes 社区设计开发,提供了两个命令:

- `/[un]assign @someone hi-rustin`: 将 Issue/PR 分配或取消分配给 someone 和 hi-rustin。
- `/[un]cc @someone hi-rustin`: 请求或取消 someone 和 hi-rustin review PR。

注意:如果在命令后不指定 GitHub 账号,则默认是自己。

## 参数配置

无参数

## 参考文档

- [assign doc](https://prow.tidb.io/plugins?repo=ti-community-infra%2Ftichi)
- [代码实现](https://github.com/kubernetes/test-infra/tree/master/prow/plugins/assign)

## Q&A

### 为什么支持以非`@`开头的用户名?

> https://github.com/ti-community-infra/tichi/issues/426
当以`@`开头时,GitHub 会自动发送邮件给对应用户,同时在机器人分配或者请求 review 后也会发送一个通知邮件。
为了减少不必要的邮件数量, assign 允许非`@`开头的用户名。
53 changes: 53 additions & 0 deletions docs/plugins/milestone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# milestone

## 设计背景

在大型仓库上我们会使用 milestone 来追踪 PR 和 Issue 的进度,但是 GitHub 限制只有写权限的协作者才能为 Issue/PR 添加 milestone。

[milestone](https://github.com/kubernetes/test-infra/tree/master/prow/plugins/milestone) 可以提供命令让机器人添加对应的 milestone。

## 权限设计

该插件主要负责添加 milestone,所以只能让 milestone 的管理团队来使用该命令。

## 设计思路

该插件由 Kubernetes 社区设计开发,提供了两个命令:

- `/milestone v1.3.2 v1.4` 添加 milestone v1.3.2 和 v1.4。
- `/milestone clear` 清除 Issue/PR 上所有的 milestones。

注意:只有 milestone 管理团队才可以使用该命令。

## 参数配置

| 参数名 | 类型 | 说明 |
| ------------------------- | ------ | -------------- |
| maintainers_id | int | GitHub 团队 ID |
| maintainers_team | string | GitHub 团队名 |
| maintainers_friendly_name | string | 团队昵称 |

例如:

```yaml
repo_milestone:
ti-community-infra/test-dev:
maintainers_id: 4300209
maintainers_team: bots-maintainers
maintainers_friendly_name: Robots Maintainers
```
## 参考文档
- [milestone doc](https://prow.tidb.io/plugins?repo=ti-community-infra%2Ftichi)
- [代码实现](https://github.com/kubernetes/test-infra/tree/master/prow/plugins/milestone)
## Q&A
### 我如何才能获取我 GitHub 团队的 ID?
```sh
curl -H "Authorization: token <token>" "https://api.github.com/orgs/<org-name>/teams?page=N"
```
通过以上 API 可以获取该组织下所有的 GitHub 团队详细信息。
Loading

0 comments on commit 561b478

Please sign in to comment.