|
| 1 | +We welcome contributions from the community. Please read the following guidelines carefully to |
| 2 | +maximize the chances of your PR being merged. |
| 3 | + |
| 4 | +# Communication |
| 5 | + |
| 6 | +* Before starting work on a major feature, please reach out to us via GitHub, Slack, |
| 7 | + email, etc. We will make sure no one else is already working on it and ask you to open a |
| 8 | + GitHub issue. |
| 9 | +* A "major feature" is defined as any change that is > 100 LOC altered (not including tests), or |
| 10 | + changes any user-facing behavior. We will use the GitHub issue to discuss the feature and come to |
| 11 | + agreement. This is to prevent your time being wasted, as well as ours. The GitHub review process |
| 12 | + for major features is also important so that [organizations with commit access](OWNERS.md) can |
| 13 | + come to agreement on design. |
| 14 | +* Small patches and bug fixes don't need prior communication. |
| 15 | + |
| 16 | +# Coding style |
| 17 | + |
| 18 | +* See [STYLE.md](STYLE.md) |
| 19 | + |
| 20 | +# Submitting a PR |
| 21 | + |
| 22 | +* Fork the repo. |
| 23 | +* Create your PR. |
| 24 | +* Tests will automatically run for you. |
| 25 | +* We will **not** merge any PR that is not passing tests. |
| 26 | +* PRs are expected to have 100% test coverage for added code. This can be verified with a coverage |
| 27 | + build. If your PR cannot have 100% coverage for some reason please clearly explain why when you |
| 28 | + open it. |
| 29 | +* All code comments and documentation are expected to have proper English grammar and punctuation. |
| 30 | + If you are not a fluent English speaker (or a bad writer ;-)) please let us know and we will try |
| 31 | + to find some help but there are no guarantees. |
| 32 | +* Your PR title should be descriptive, and generally start with a subsystem name followed by a |
| 33 | + colon. Examples: |
| 34 | + * "docs: fix grammar error" |
| 35 | + * "http conn man: add new feature" |
| 36 | +* Your PR description should have details on what the PR does. If it fixes an existing issue it |
| 37 | + should end with "Fixes #XXX". |
| 38 | +* When all of the tests are passing and all other conditions described herein are satisfied, we |
| 39 | + will review it and merge. |
| 40 | +* Once you submit a PR, *please do not rebase it*. It's much easier to review if subsequent commits |
| 41 | + are new commits and/or merges. We squash rebase the final merged commit so the number of commits |
| 42 | + you have in the PR don't matter. |
| 43 | +* We expect that once a PR is opened, it will be actively worked on until it is merged or closed. |
| 44 | + We reserve the right to close PRs that are not making progress. This is generally defined as no |
| 45 | + changes for 7 days. Obviously PRs that are closed due to lack of activity can be reopened later. |
| 46 | + Closing stale PRs helps us keep on top of all of the work currently in flight. |
| 47 | +* If a commit deprecates a feature, the commit message must mention what has been deprecated. |
| 48 | +* Please consider joining the [envoy-dev](https://groups.google.com/forum/#!forum/envoy-dev) |
| 49 | + mailing list. |
| 50 | + |
| 51 | +# PR review policy for maintainers |
| 52 | + |
| 53 | +* Typically we try to turn around reviews within one business day. |
| 54 | +* See [OWNERS.md](OWNERS.md) for the current list of maintainers. |
| 55 | +* It is generally expected that a senior maintainer should review every PR. |
| 56 | +* It is also generally expected that a "domain expert" for the code the PR touches should review the |
| 57 | + PR. This person does not necessarily need to have commit access. |
| 58 | +* The previous two points generally mean that every PR should have two approvals. (Exceptions can |
| 59 | + be made by the senior maintainers). |
| 60 | +* The above rules may be waived for PRs which only update docs or comments, or trivial changes to |
| 61 | + tests and tools (where trivial is decided by the maintainer in question). |
| 62 | +* In general, we should also attempt to make sure that at least one of the approvals is *from an |
| 63 | + organization different from the PR author.* E.g., if Lyft authors a PR, at least one approver |
| 64 | + should be from an organization other than Lyft. This helps us make sure that we aren't putting |
| 65 | + organization specific shortcuts into the code. |
| 66 | +* If there is a question on who should review a PR please discuss in Slack. |
| 67 | +* Anyone is welcome to review any PR that they want, whether they are a maintainer or not. |
| 68 | +* Please **clean up the commit message** before merging. By default, GitHub fills the squash merge |
| 69 | + commit message with every individual commit from the PR. Generally, we want a commit message |
| 70 | + that is roughly equal to the original PR title and description. |
| 71 | +* If a PR includes a deprecation/breaking change, notification should be sent to the |
| 72 | + [envoy-announce](https://groups.google.com/forum/#!forum/envoy-announce) email list. |
| 73 | + |
| 74 | +# DCO: Sign your work |
| 75 | + |
| 76 | +The sign-off is a simple line at the end of the explanation for the |
| 77 | +patch, which certifies that you wrote it or otherwise have the right to |
| 78 | +pass it on as an open-source patch. The rules are pretty simple: if you |
| 79 | +can certify the below (from |
| 80 | +[developercertificate.org](http://developercertificate.org/)): |
| 81 | + |
| 82 | +``` |
| 83 | +Developer Certificate of Origin |
| 84 | +Version 1.1 |
| 85 | +
|
| 86 | +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. |
| 87 | +660 York Street, Suite 102, |
| 88 | +San Francisco, CA 94110 USA |
| 89 | +
|
| 90 | +Everyone is permitted to copy and distribute verbatim copies of this |
| 91 | +license document, but changing it is not allowed. |
| 92 | +
|
| 93 | +
|
| 94 | +Developer's Certificate of Origin 1.1 |
| 95 | +
|
| 96 | +By making a contribution to this project, I certify that: |
| 97 | +
|
| 98 | +(a) The contribution was created in whole or in part by me and I |
| 99 | + have the right to submit it under the open source license |
| 100 | + indicated in the file; or |
| 101 | +
|
| 102 | +(b) The contribution is based upon previous work that, to the best |
| 103 | + of my knowledge, is covered under an appropriate open source |
| 104 | + license and I have the right under that license to submit that |
| 105 | + work with modifications, whether created in whole or in part |
| 106 | + by me, under the same open source license (unless I am |
| 107 | + permitted to submit under a different license), as indicated |
| 108 | + in the file; or |
| 109 | +
|
| 110 | +(c) The contribution was provided directly to me by some other |
| 111 | + person who certified (a), (b) or (c) and I have not modified |
| 112 | + it. |
| 113 | +
|
| 114 | +(d) I understand and agree that this project and the contribution |
| 115 | + are public and that a record of the contribution (including all |
| 116 | + personal information I submit with it, including my sign-off) is |
| 117 | + maintained indefinitely and may be redistributed consistent with |
| 118 | + this project or the open source license(s) involved. |
| 119 | +``` |
| 120 | + |
| 121 | +then you just add a line to every git commit message: |
| 122 | + |
| 123 | + Signed-off-by: Joe Smith <[email protected]> |
| 124 | + |
| 125 | +using your real name (sorry, no pseudonyms or anonymous contributions.) |
| 126 | + |
| 127 | +You can add the sign off when creating the git commit via `git commit -s`. |
| 128 | + |
| 129 | +If you want this to be automatic you can set up some aliases: |
| 130 | + |
| 131 | +```bash |
| 132 | +git config --add alias.amend "commit -s --amend" |
| 133 | +git config --add alias.c "commit -s" |
| 134 | +``` |
| 135 | + |
| 136 | +## Fixing DCO |
| 137 | + |
| 138 | +If your PR fails the DCO check, it's necessary to fix the entire commit history in the PR. Best |
| 139 | +practice is to [squash](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) |
| 140 | +the commit history to a single commit, append the DCO sign-off as described above, and [force |
| 141 | +push](https://git-scm.com/docs/git-push#git-push---force). For example, if you have 2 commits in |
| 142 | +your history: |
| 143 | + |
| 144 | +```bash |
| 145 | +git rebase -i HEAD^^ |
| 146 | +(interactive squash + DCO append) |
| 147 | +git push origin -f |
| 148 | +``` |
| 149 | + |
| 150 | +Note, that in general rewriting history in this way is a hindrance to the review process and this |
| 151 | +should only be done to correct a DCO mistake. |
0 commit comments