Update pull request guide

This commit is contained in:
Ray Zhou 2020-03-18 14:42:35 +08:00
parent a7f7fca297
commit 7b7e8b79c5

View File

@ -1,33 +1,30 @@
# Pull Request Process
This doc explains the process and best practices for submitting a PR to the [KubeSphere project](https://github.com/kubeSphere/kubeSphere). It should serve as a reference for all contributors, and be useful especially to new and infrequent submitters.
This document explains the process and best practices for submitting a PR to the [KubeSphere project](https://github.com/kubeSphere/kubeSphere). It should serve as a reference for all contributors, and be useful especially to new and infrequent submitters.
- [Before You Submit a PR](#before-you-submit-a-pr)
* [Run Local Verifications](#run-local-verifications)
- [Run Local Verifications](#run-local-verifications)
- [The PR Submit Process](#the-pr-submit-process)
* [Write Release Notes if Needed](#write-release-notes-if-needed)
* [The Testing and Merge Workflow](#the-testing-and-merge-workflow)
* [Marking Unfinished Pull Requests](#marking-unfinished-pull-requests)
* [Comment Commands Reference](#comment-commands-reference)
* [Automation](#automation)
* [How the e2e Tests Work](#how-the-e2e-tests-work)
- [Write Release Notes if Needed](#write-release-notes-if-needed)
- [The Testing and Merge Workflow](#the-testing-and-merge-workflow)
- [Marking Unfinished Pull Requests](#marking-unfinished-pull-requests)
- [Comment Commands Reference](#comment-commands-reference)
- [Automation](#automation)
- [How the e2e Tests Work](#how-the-e2e-tests-work)
## Before You Submit a PR
This guide is for contributors who already have a PR to submit. If you're looking for information on setting up your developer environment and writing code to contribute to KubeSphere, see the [development guide](/developer-guide/development/development-workflow.md).
# Before You Submit a PR
**Make sure your PR adheres to our best practices. These include following project conventions, making small PRs, and commenting thoroughly. Please read the more detailed section on [Best Practices for Faster Reviews](#best-practices-for-faster-reviews) at the end of this document.**
This guide is for contributors who already have a PR to submit. If you're looking for information on setting up your developer environment and creating code to contribute to KubeSphere, see the [development guide](development.md).
### Run Local Verifications
**Make sure your PR adheres to our best practices. These include following project conventions, making small PRs, and commenting thoroughly. Please read the more detailed section on [Best Practices for Faster Reviews](#best-practices-for-faster-reviews) at the end of this doc.**
You can run these local verifications before you submit your PR to predict the pass or fail of continuous integration.
## Run Local Verifications
## The PR Submit Process
You can run these local verifications before you submit your PR to predict the
pass or fail of continuous integration.
# The PR Submit Process
Merging a PR requires the following steps to be completed before the PR will be merged automatically. For details about each step, see the [The Testing and Merge Workflow](#the-testing-and-merge-workflow) section below.
Merging a PR requires the following steps to be completed before the PR is merged automatically. For details about each step, see the [The Testing and Merge Workflow](#the-testing-and-merge-workflow) section below.
- Make the PR
- Release notes - do one of the following:
@ -39,7 +36,7 @@ Merging a PR requires the following steps to be completed before the PR will be
If your PR meets all of the steps above, it will enter the submit queue to be merged. When it is next in line to be merged, the tests will run a second time. If all tests pass, the PR will be merged automatically.
## Write Release Notes if Needed
### Write Release Notes if Needed
Release notes are required for any PR with user-visible changes, such as bug-fixes, feature additions, and output format changes.
@ -76,48 +73,47 @@ Release notes apply to PRs on the master branch. For cherry-pick PRs, see the [c
Now that your release notes are in shape, let's look at how the PR gets tested and merged.
## The Testing and Merge Workflow
### The Testing and Merge Workflow
The KubeSphere merge workflow uses comments to run tests and labels for merging PRs.
NOTE: For pull requests that are in progress but not ready for review,
prefix the PR title with `WIP` or `[WIP]` and track any remaining TODOs
in a checklist in the pull request description.
NOTE: For pull requests that are in progress but not ready for review, prefix the PR title with `WIP` or `[WIP]` and track any remaining TODOs in a checklist in the pull request description.
Here's the process the PR goes through on its way from submission to merging:
1. Make the pull request
1. `@o8x-merge-robot` assigns reviewers //TODO
2. `@o8x-merge-robot` assigns reviewers //TODO
If you're **not** a member of the KubeSphere organization:
1. Reviewer/KubeSphere Member checks that the PR is safe to test. If so, they comment `/ok-to-test`
1. Reviewer suggests edits
1. Push edits to your PR branch
1. Repeat the prior two steps as needed
1. (Optional) Some reviewers prefer that you squash commits at this step
1. Owner is assigned and will add the `/approve` label to the PR
1. Reviewer/KubeSphere member checks that the PR is safe to test. If so, they comment `/ok-to-test`
2. Reviewer suggests edits
3. Push edits to your PR branch
4. Repeat the prior two steps as needed
5. (Optional) Some reviewers prefer that you squash commits at this step
6. Owner is assigned and will add the `/approve` label to the PR
If you are a member, or a member comments `/ok-to-test`, the PR will be considered to be trusted. Then the pre-submit tests will run:
1. Automatic tests run. See the current list of tests on the
1. If tests fail, resolve issues by pushing edits to your PR branch
1. If the failure is a flake, anyone on trusted PRs can comment `/retest` to rerun failed tests
1. Automatic tests run. See the current list of tests on the PR
2. If tests fail, resolve issues by pushing edits to your PR branch
3. If the failure is a flake, anyone on trusted PRs can comment `/retest` to rerun failed tests
Once the tests pass, all failures are commented as flakes, or the reviewer adds the labels `lgtm` and `approved`, the PR enters the final merge queue. The merge queue is needed to make sure no incompatible changes have been introduced by other PRs since the tests were last run on your PR.
Either the [on call contributor](on-call-rotations.md) will manage the merge queue manually. //TODO
1. The PR enters the merge queue ([http://submit-queue.KubeSphere.io]())
1. The merge queue triggers a test re-run with the comment `/test all [submit-queue is verifying that this PR is safe to merge]`
1. Author has signed the CLA (`cncf-cla: yes` label added to PR)
1. No changes made since last `lgtm` label applied
1. If tests fail, resolve issues by pushing edits to your PR branch
1. If the failure is a flake, anyone can comment `/retest` if the PR is trusted
1. If tests pass, the merge queue automatically merges the PR
2. The merge queue triggers a test re-run with the comment `/test all [submit-queue is verifying that this PR is safe to merge]`
2.1. Author has signed the CLA (`cncf-cla: yes` label added to PR)
2.2. No changes made since last `lgtm` label applied
3. If tests fail, resolve issues by pushing edits to your PR branch
4. If the failure is a flake, anyone can comment `/retest` if the PR is trusted
5. If tests pass, the merge queue automatically merges the PR
That's the last step. Your PR is now merged.
## Marking Unfinished Pull Requests
### Marking Unfinished Pull Requests
If you want to solicit reviews before the implementation of your pull request is complete, you should hold your pull request to ensure that the merge queue does not pick it up and attempt to merge it. There are two methods to achieve this:
@ -126,16 +122,15 @@ If you want to solicit reviews before the implementation of your pull request is
The GitHub robots will add and remove the `do-not-merge/hold` label as you use the comment commands and the `do-not-merge/work-in-progress` label as you edit your title. While either label is present, your pull request will not be considered for merging.
## Comment Commands Reference//TODO
### Comment Commands Reference//TODO
[The commands doc]() contains a reference for all comment commands. //TODO
## Automation//TODO
### Automation//TODO
The KubeSphere developer community uses a variety of automation to manage pull requests. This automation is described in detail [in the automation doc](automation.md). //TODO
## How the e2e Tests Work//TODO
### How the e2e Tests Work//TODO
The tests will post the status results to the PR. If an e2e test fails,
`@o8x-ci-robot` will comment on the PR with the test history and the