|
Packit Service |
751c4a |
*******************
|
|
Packit Service |
751c4a |
Code Review Process
|
|
Packit Service |
751c4a |
*******************
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
In order to manage incoming pull requests effectively, and provide
|
|
Packit Service |
751c4a |
timely feedback and/or acceptance this document serves as a guideline
|
|
Packit Service |
751c4a |
for the review process and outlines the expectations for those
|
|
Packit Service |
751c4a |
submitting code to the project as well as those reviewing the code.
|
|
Packit Service |
751c4a |
Code is reviewed for acceptance by at least one core team member (later
|
|
Packit Service |
751c4a |
referred to as committers), but comments and suggestions from others
|
|
Packit Service |
751c4a |
are encouraged and welcome.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
The process is intended to provide timely and actionable feedback for
|
|
Packit Service |
751c4a |
any submission.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Asking For Help
|
|
Packit Service |
751c4a |
===============
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
cloud-init contributors, potential contributors, community members and
|
|
Packit Service |
751c4a |
users are encouraged to ask for any help that they need. If you have
|
|
Packit Service |
751c4a |
questions about the code review process, or at any point during the
|
|
Packit Service |
751c4a |
code review process, these are the available avenues:
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
* if you have an open Pull Request, comment on that pull request
|
|
Packit Service |
751c4a |
* join the ``#cloud-init`` channel on the Freenode IRC network and ask
|
|
Packit Service |
751c4a |
away
|
|
Packit Service |
751c4a |
* send an email to the cloud-init mailing list,
|
|
Packit Service |
751c4a |
cloud-init@lists.launchpad.net
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
These are listed in rough order of preference, but use whichever of
|
|
Packit Service |
751c4a |
them you are most comfortable with.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Goals
|
|
Packit Service |
751c4a |
=====
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
This process has the following goals:
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
* Ensure code reviews occur in a timely fashion and provide actionable
|
|
Packit Service |
751c4a |
feedback if changes are desired.
|
|
Packit Service |
751c4a |
* Ensure the minimization of ancillary problems to increase the
|
|
Packit Service |
751c4a |
efficiency for those reviewing the submitted code
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Role Definitions
|
|
Packit Service |
751c4a |
================
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Any code review process will have (at least) two involved parties. For
|
|
Packit Service |
751c4a |
our purposes, these parties are referred to as **Proposer** and
|
|
Packit Service |
751c4a |
**Reviewer**. (We also have the **Committer** role which is a special
|
|
Packit Service |
751c4a |
case of the **Reviewer** role.) The terms are defined here (and the
|
|
Packit Service |
751c4a |
use of the singular form is not meant to imply that they refer to a
|
|
Packit Service |
751c4a |
single person):
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Proposer
|
|
Packit Service |
751c4a |
The person proposing a pull request (hereafter known as a PR).
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Reviewer
|
|
Packit Service |
751c4a |
A person who is reviewing a PR.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Committer
|
|
Packit Service |
751c4a |
A cloud-init core developer (i.e. a person who has permission to
|
|
Packit Service |
751c4a |
merge PRs into master).
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Prerequisites For Landing Pull Requests
|
|
Packit Service |
751c4a |
=======================================
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Before a PR can be landed into master, the following conditions *must*
|
|
Packit Service |
751c4a |
be met:
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
* the CLA has been signed by the **Proposer** (or is covered by an
|
|
Packit Service |
751c4a |
entity-level CLA signature)
|
|
Packit Service |
751c4a |
* all required status checks are passing
|
|
Packit Service |
751c4a |
* at least one "Approve" review from a **Committer**
|
|
Packit Service |
751c4a |
* no "Request changes" reviews from any **Committer**
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
The following conditions *should* be met:
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
* any Python functions/methods/classes have docstrings added/updated
|
|
Packit Service |
751c4a |
* any changes to config module behaviour are captured in the
|
|
Packit Service |
751c4a |
documentation of the config module
|
|
Packit Service |
751c4a |
* any Python code added has corresponding unit tests
|
|
Packit Service |
751c4a |
* no "Request changes" reviews from any **Reviewer**
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
These conditions can be relaxed at the discretion of the
|
|
Packit Service |
751c4a |
**Committers** on a case-by-case basis. Generally, for accountability,
|
|
Packit Service |
751c4a |
this should not be the decision of a single **Committer**, and the
|
|
Packit Service |
751c4a |
decision should be documented in comments on the PR.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
(To take a specific example, the ``cc_phone_home`` module had no tests
|
|
Packit Service |
751c4a |
at the time `PR #237
|
|
Packit Service |
751c4a |
<https://github.com/canonical/cloud-init/pull/237>`_ was submitted, so
|
|
Packit Service |
751c4a |
the **Proposer** was not expected to write a full set of tests for
|
|
Packit Service |
751c4a |
their minor modification, but they were expected to update the config
|
|
Packit Service |
751c4a |
module docs.)
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Non-Committer Reviews
|
|
Packit Service |
751c4a |
=====================
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Reviews from non-**Committers** are *always* welcome. Please feel
|
|
Packit Service |
751c4a |
empowered to review PRs and leave your thoughts and comments on any
|
|
Packit Service |
751c4a |
submitted PRs, regardless of the **Proposer**.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Much of the below process is written in terms of the **Committers**.
|
|
Packit Service |
751c4a |
This is not intended to reflect that reviews should only come from that
|
|
Packit Service |
751c4a |
group, but acknowledges that we are ultimately responsible for
|
|
Packit Service |
751c4a |
maintaining the standards of the codebase. It would be entirely
|
|
Packit Service |
751c4a |
reasonable (and very welcome) for a **Reviewer** to only examine part
|
|
Packit Service |
751c4a |
of a PR, but it would not be appropriate for a **Committer** to merge a
|
|
Packit Service |
751c4a |
PR without full scrutiny.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Opening Phase
|
|
Packit Service |
751c4a |
=============
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
In this phase, the **Proposer** is responsible for opening a pull
|
|
Packit Service |
751c4a |
request and meeting the prerequisites laid out above.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
If they need help understanding the prerequisites, or help meeting the
|
|
Packit Service |
751c4a |
prerequisites, then they can (and should!) ask for help. See the
|
|
Packit Service |
751c4a |
:ref:`Asking For Help` section above for the ways to do that.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
These are the steps that comprise the opening phase:
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
1. The **Proposer** opens PR
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
2. CI runs automatically, and if
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
CI fails
|
|
Packit Service |
751c4a |
The **Proposer** is expected to fix CI failures. If the
|
|
Packit Service |
751c4a |
**Proposer** doesn't understand the nature of the failures they
|
|
Packit Service |
751c4a |
are seeing, they should comment in the PR to request assistance,
|
|
Packit Service |
751c4a |
or use another way of :ref:`Asking For Help`.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
(Note that if assistance is not requested, the **Committers**
|
|
Packit Service |
751c4a |
will assume that the **Proposer** is working on addressing the
|
|
Packit Service |
751c4a |
failures themselves. If you require assistance, please do ask
|
|
Packit Service |
751c4a |
for help!)
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
CI passes
|
|
Packit Service |
751c4a |
Move on to the :ref:`Review phase`.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Review Phase
|
|
Packit Service |
751c4a |
============
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
In this phase, the **Proposer** and the **Reviewers** will iterate
|
|
Packit Service |
751c4a |
together to, hopefully, get the PR merged into the cloud-init codebase.
|
|
Packit Service |
751c4a |
There are three potential outcomes: merged, rejected permanently, and
|
|
Packit Service |
751c4a |
temporarily closed. (The first two are covered in this section; see
|
|
Packit Service |
751c4a |
:ref:`Inactive Pull Requests` for details about temporary closure.)
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
(In the below, when the verbs "merge" or "squash merge" are used, they
|
|
Packit Service |
751c4a |
should be understood to mean "squash merged using the GitHub UI", which
|
|
Packit Service |
751c4a |
is the only way that changes can land in cloud-init's master branch.)
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
These are the steps that comprise the review phase:
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
1. **The Committers** assign a **Committer** to the PR
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
This **Committer** is expected to shepherd the PR to completion (and
|
|
Packit Service |
751c4a |
merge it, if that is the outcome reached). This means that they
|
|
Packit Service |
751c4a |
will perform an initial review, and monitor the PR to ensure that
|
|
Packit Service |
751c4a |
the **Proposer** is receiving any assistance that they require. The
|
|
Packit Service |
751c4a |
**Committers** will perform this assignment on a daily basis.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
This assignment is intended to ensure that the **Proposer** has a
|
|
Packit Service |
751c4a |
clear point of contact with a cloud-init core developer, and that
|
|
Packit Service |
751c4a |
they get timely feedback after submitting a PR. It *is not*
|
|
Packit Service |
751c4a |
intended to preclude reviews from any other **Reviewers**, nor to
|
|
Packit Service |
751c4a |
imply that the **Committer** has ownership over the review process.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
The assigned **Committer** may choose to delegate the code review of
|
|
Packit Service |
751c4a |
a PR to another **Reviewer** if they think that they would be better
|
|
Packit Service |
751c4a |
suited.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
(Note that, in GitHub terms, this is setting an Assignee, not
|
|
Packit Service |
751c4a |
requesting a review.)
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
2. That **Committer** performs an initial review of the PR, resulting
|
|
Packit Service |
751c4a |
in one of the following:
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Approve
|
|
Packit Service |
751c4a |
If the submitted PR meets all of the :ref:`Prerequisites for
|
|
Packit Service |
751c4a |
Landing Pull Requests` and passes code review, then the
|
|
Packit Service |
751c4a |
**Committer** will squash merge immediately.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
There may be circumstances where a PR should not be merged
|
|
Packit Service |
751c4a |
immediately. The ``wip`` label will be applied to PRs for which
|
|
Packit Service |
751c4a |
this is true. Only **Committers** are able to apply labels to
|
|
Packit Service |
751c4a |
PRs, so anyone who believes that this label should be applied to a
|
|
Packit Service |
751c4a |
PR should request its application in a comment on the PR.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
The review process is **DONE**.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Approve (with nits)
|
|
Packit Service |
751c4a |
If the **Proposer** submits their PR with "Allow edits from
|
|
Packit Service |
751c4a |
maintainer" enabled, and the only changes the **Committer**
|
|
Packit Service |
751c4a |
requests are minor "nits", the **Committer** can push fixes for
|
|
Packit Service |
751c4a |
those nits and *immediately* squash merge. If the **Committer**
|
|
Packit Service |
751c4a |
does not wish to fix these nits but believes they should block a
|
|
Packit Service |
751c4a |
straight-up Approve, then their review should be "Needs Changes"
|
|
Packit Service |
751c4a |
instead.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
A nit is understood to be something like a minor style issue or a
|
|
Packit Service |
751c4a |
spelling error, generally confined to a single line of code.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
If a **Committer** is unsure as to whether their requested change
|
|
Packit Service |
751c4a |
is a nit, they should not treat it as a nit.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
(If a **Proposer** wants to opt-out of this, then they should
|
|
Packit Service |
751c4a |
uncheck "Allow edits from maintainer" when submitting their PR.)
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
The review process is **DONE**.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Outright rejection
|
|
Packit Service |
751c4a |
The **Committer** will close the PR, with useful messaging for the
|
|
Packit Service |
751c4a |
**Proposer** as to why this has happened.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
This is reserved for cases where the proposed change is completely
|
|
Packit Service |
751c4a |
unfit for landing, and there is no reasonable path forward. This
|
|
Packit Service |
751c4a |
should only be used sparingly, as there are very few cases where
|
|
Packit Service |
751c4a |
proposals are completely unfit.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
If a different approach to the same problem is planned, it should
|
|
Packit Service |
751c4a |
be submitted as a separate PR. The **Committer** should include
|
|
Packit Service |
751c4a |
this information in their message when the PR is closed.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
The review process is **DONE**.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Needs Changes
|
|
Packit Service |
751c4a |
The **Committer** will give the **Proposer** a clear idea of what
|
|
Packit Service |
751c4a |
is required for an Approve vote or, for more complex PRs, what the
|
|
Packit Service |
751c4a |
next steps towards an Approve vote are.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
The **Proposer** will ask questions if they don't understand, or
|
|
Packit Service |
751c4a |
disagree with, the **Committer**'s review comments.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Once consensus has been reached, the **Proposer** will address the
|
|
Packit Service |
751c4a |
review comments.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Once the review comments are addressed (as well as, potentially,
|
|
Packit Service |
751c4a |
in the interim), CI will run. If CI fails, the **Proposer** is
|
|
Packit Service |
751c4a |
expected to fix CI failures. If CI passes, the **Proposer**
|
|
Packit Service |
751c4a |
should indicate that the PR is ready for re-review (by @ing the
|
|
Packit Service |
751c4a |
assigned reviewer), effectively moving back to the start of this
|
|
Packit Service |
751c4a |
section.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
Inactive Pull Requests
|
|
Packit Service |
751c4a |
======================
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
PRs will be temporarily closed if they have been waiting on
|
|
Packit Service |
751c4a |
**Proposer** action for a certain amount of time without activity. A
|
|
Packit Service |
751c4a |
PR will be marked as stale (with an explanatory comment) after 14 days
|
|
Packit Service |
751c4a |
of inactivity. It will be closed after a further 7 days of inactivity.
|
|
Packit Service |
751c4a |
|
|
Packit Service |
751c4a |
These closes are not considered permanent, and the closing message
|
|
Packit Service |
751c4a |
should reflect this for the **Proposer**. However, if a PR is reopened,
|
|
Packit Service |
751c4a |
it should effectively enter the :ref:`Opening phase` again, as it may
|
|
Packit Service |
751c4a |
need some work done to get CI passing again.
|