blob: 107473a9f1505628036f280f6cbaabaaa419e997 [file] [log] [blame]
Marian Harbachebeb1542019-12-13 10:42:46 +01001:linkattrs:
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002= Gerrit Code Review - Contributing
Martin Fick081fa512011-08-12 11:22:45 -06003
Edwin Kempin21186702019-04-24 10:07:09 +02004[[cla]]
5== Contributor License Agreement
Martin Fick081fa512011-08-12 11:22:45 -06006
Edwin Kempin21186702019-04-24 10:07:09 +02007In order to contribute to Gerrit a link:dev-cla.html[Contributor
Marco Miller50107212020-04-21 15:42:55 -04008License Agreement,role=external,window=_blank] must be completed before
9contributions are accepted.
Edwin Kempin21186702019-04-24 10:07:09 +020010
Edwin Kempin099a5ec2019-04-25 16:15:14 +020011[[contribution-processes]]
12== Contribution Processes
13
14The Gerrit project offers two contribution processes:
15
16* link:#lightweight-contribution-process[Lightweight Contribution
17 Process]
18* link:#design-driven-contribution-process[Design-Driven Contribution
19 Process]
20
21The lightweight contribution process has little overhead and is best
22suited for small contributions (documentation updates, bug fixes, small
23features). Contributions are pushed as changes and
Marco Miller50107212020-04-21 15:42:55 -040024link:dev-roles.html#maintainer[maintainers,role=external,window=_blank]
25review them adhoc.
Edwin Kempin099a5ec2019-04-25 16:15:14 +020026
Wendy Wang91d3b6e2022-05-12 14:41:01 +020027For large/complex features, it is required to specify the feature in a
28link:dev-design-docs.html[design document,role=external,window=_blank] before
29starting implementation, as per the
30link:#design-driven-contribution-process[design-driven contribution process].
Edwin Kempin099a5ec2019-04-25 16:15:14 +020031
Marco Miller50107212020-04-21 15:42:55 -040032If link:dev-roles.html#contributor[contributors,role=external,window=_blank]
Wendy Wang91d3b6e2022-05-12 14:41:01 +020033choose the lightweight contribution process but the feature is found to be
34large or complex, link:dev-roles.html#maintainer[maintainers,role=external,window=_blank]
35can require that the design-driven contribution process be followed instead.
Edwin Kempin099a5ec2019-04-25 16:15:14 +020036
37If you are in doubt which process is right for you, consult the
Marian Harbach34253372019-12-10 18:01:31 +010038link:https://groups.google.com/d/forum/repo-discuss[repo-discuss,role=external,window=_blank]
Edwin Kempin099a5ec2019-04-25 16:15:14 +020039mailing list.
40
41These contribution processes apply to everyone who contributes code to
Wendy Wang91d3b6e2022-05-12 14:41:01 +020042the Gerrit project. link:dev-roles.html#maintainer[
43Maintainers,role=external,window=_blank] are also considered contributors
44when they contribute code.
Edwin Kempin099a5ec2019-04-25 16:15:14 +020045
Edwin Kempinf13dfa92019-05-02 13:55:43 +020046If a new feature is large or complex, it is often difficult to find a
Wendy Wang91d3b6e2022-05-12 14:41:01 +020047maintainer who can take the time that is needed for a thorough review. This
48can result in unpredictably long waiting times before the changes are
49submitted. To avoid that, contributors can ask for link:#mentorship[mentor support].
50A mentor helps with timely code reviews and technical guidance, though the
51implementation itself is still the responsibility of the contributor.
Edwin Kempinf13dfa92019-05-02 13:55:43 +020052
Edwin Kempin099a5ec2019-04-25 16:15:14 +020053[[comparison]]
54=== Quick Comparison
55
56[options="header"]
57|======================
58| |Lightweight Contribution Process|Design-Driven Contribution Process
59|Overhead|low (write good commit message, address review comments)|
Marco Miller50107212020-04-21 15:42:55 -040060high (write link:dev-design-docs.html[design doc,role=external,window=_blank]
61and get it approved)
Edwin Kempin099a5ec2019-04-25 16:15:14 +020062|Technical Guidance|by reviewer|during the design review and by
Edwin Kempinf13dfa92019-05-02 13:55:43 +020063reviewer/mentor
64|Review |adhoc (when reviewer is available)|by a dedicated mentor (if
65a link:#mentorship[mentor] was assigned)
Edwin Kempin099a5ec2019-04-25 16:15:14 +020066|Caveats |features may get vetoed after the implementation was already
Wendy Wang91d3b6e2022-05-12 14:41:01 +020067done, maintainers may require the design-driven contribution process
68be followed if a change gets too complex/large|design doc must stay open
Edwin Kempinf13dfa92019-05-02 13:55:43 +020069for a minimum of 10 calendar days, a mentor may not be available
70immediately
Edwin Kempin099a5ec2019-04-25 16:15:14 +020071|Applicable to|documentation updates, bug fixes, small features|
72large/complex features
73|======================
74
75[[lightweight-contribution-process]]
76=== Lightweight Contribution Process
77
78The lightweight contribution process has little overhead and is best
79suited for small contributions (documentation updates, bug fixes, small
80features). For large/complex features the
81link:#design-driven-contribution-process[design-driven contribution
82process] is required.
Edwin Kempin21186702019-04-24 10:07:09 +020083
Wendy Wang91d3b6e2022-05-12 14:41:01 +020084To start contributing to Gerrit, upload your git commit for review to the
85link:https://gerrit-review.googlesource.com/[gerrit-review.googlesource.com,
86role=external,window=_blank] Gerrit server. Review these link:dev-crafting-changes.html[
Marco Miller50107212020-04-21 15:42:55 -040087guidelines,role=external,window=_blank] before submitting your change. You can
Wendy Wang91d3b6e2022-05-12 14:41:01 +020088view pending contributions link:https://gerrit-review.googlesource.com/#/q/status:open+project:gerrit[here,role=external,window=_blank].
Martin Fick081fa512011-08-12 11:22:45 -060089
90Depending on the size of that list it might take a while for
Wendy Wang91d3b6e2022-05-12 14:41:01 +020091your change to get reviewed. Anything that you can do to ensure that your
92contribution will undergo fewer revisions will speed up the contribution process.
93This includes helping out reviewing other people's changes to relieve the
94load from the maintainers. Even if you are not familiar with Gerrit's internals,
Edwin Kempin099a5ec2019-04-25 16:15:14 +020095it would be of great help if you can download, try out, and comment on
Wendy Wang91d3b6e2022-05-12 14:41:01 +020096new features. If it works as advertised, say so, and if you have the
Edwin Kempin099a5ec2019-04-25 16:15:14 +020097privileges to do so, go ahead and give it a `+1 Verified`. If you
98would find the feature useful, say so and give it a `+1 Code Review`.
Martin Fick081fa512011-08-12 11:22:45 -060099
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200100Finally, the quicker you respond to the comments of your reviewers, the
101quicker your change can be merged! Try to reply to every comment after
102submitting your new patch, particularly if you decided against making the
103suggested change. Reviewers don't want to seem like nags and pester you
104if you haven't replied or made a fix, so it helps them know if you missed
105it or decided against it.
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200106
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200107A new feature or API extension, even if small, can incur a long-time
108maintenance and support burden and should be left pending for 24 hours
109to give maintainers in all time zones a chance to evaluate the change.
Han-Wen Nienhuys0ad68fb2021-02-04 16:33:28 +0100110
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200111[[design-driven-contribution-process]]
112=== Design-driven Contribution Process
113
114The design-driven contribution process applies to large/complex
115features.
116
117For large/complex features it is important to:
118
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200119* agree on functionality and scope before spending too much time on
120 implementation
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200121* ensure that they are in line with Gerrit's project scope and vision
122* ensure that they are well aligned with other features
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200123* consider how the feature could be evolved over time
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200124
125This is why for large/complex features it is required to describe the
Marco Miller50107212020-04-21 15:42:55 -0400126feature in a link:dev-design-docs.html[design doc,role=external,window=_blank]
127and get it approved by the
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200128link:dev-processes.html#steering-committee[steering committee,role=external,window=_blank]
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200129before starting the implementation.
130
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200131The design-driven contribution process consists of the following steps:
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200132
Marco Miller50107212020-04-21 15:42:55 -0400133* A link:dev-roles.html#contributor[contributor,role=external,window=_blank]
134 link:dev-design-docs.html#propose[proposes,role=external,window=_blank] a new
135 feature by uploading a change with a
136 link:dev-design-docs.html[design doc,role=external,window=_blank].
137* The design doc is link:dev-design-docs.html#review[reviewed,role=external,window=_blank]
138 by interested parties from the community. The design review is public
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200139 and everyone can comment and raise concerns.
140* Design docs should stay open for a minimum of 10 calendar days so
141 that everyone has a fair chance to join the review.
Edwin Kempinc507dbb2020-06-08 11:53:56 +0200142* Within 30 calendar days the contributor should hear back from the
Marco Miller50107212020-04-21 15:42:55 -0400143 link:dev-processes.html#steering-committee[steering committee,role=external,window=_blank]
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200144 whether the proposed feature is in scope of the project and if it can
145 be accepted.
146* To be submitted, the design doc needs to be approved by the
Marco Miller50107212020-04-21 15:42:55 -0400147 link:dev-processes.html#steering-committee[steering committee,role=external,window=_blank].
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200148* After the design is approved, it is implemented by pushing
149 changes for review, see the link:#lightweight-contribution-process[
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200150 lightweight contribution process]. Changes that are associated with
151 a design should all share a common hashtag. The contributor is the
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200152 main driver of the implementation and responsible for its completion.
153 Others from the Gerrit community are usually welcome to help.
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200154
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200155The design doc does not need to fully specify each detail of the feature,
156but its concept and how it fits into Gerrit should be sufficiently clear,
157as judged by the steering committee. Contributors are expected to keep
158the design doc updated and fill in gaps while they go forward with the
159implementation. We expect that implementing the feature and updating the
160design doc will be an iterative process.
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200161
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200162While the design doc is still in review, contributors may start with the
163implementation (e.g. do some prototyping to demonstrate parts of the
164proposed design), but those changes should not be submitted while the
165design is not yet approved. Another way to demonstrate the design can be
166mocking screenshots in the doc.
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200167
168By approving a design, the steering committee commits to:
169
170* Accepting the feature when it is implemented.
Edwin Kempinf13dfa92019-05-02 13:55:43 +0200171* Supporting the feature by assigning a link:dev-roles.html#mentor[
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200172 mentor,role=external,window=_blank] if requested (see link:#mentorship[mentorship]).
Edwin Kempin099a5ec2019-04-25 16:15:14 +0200173
174For contributors, the design-driven contribution process has the
175following advantages:
176
177* By writing a design doc, the feature gets more attention. During the
178 design review, feedback from various sides can be collected, which
179 likely leads to improvements of the feature.
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200180* Once a design is approved by the
Marco Miller50107212020-04-21 15:42:55 -0400181 link:dev-processes.html#steering-committee[steering committee,role=external,window=_blank],
182 the contributor can be almost certain that the feature will be accepted.
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200183 Hence, there little risk of the feature being rejected later in code review,
184 as can occur with the lightweight contribution process.
Edwin Kempinf13dfa92019-05-02 13:55:43 +0200185* The contributor can link:#mentorship[get a dedicated mentor assigned]
186 who provides timely reviews and serves as a contact person for
187 technical questions and discussing details of the design.
188
189[[mentorship]]
190== Mentorship
191
Marco Miller50107212020-04-21 15:42:55 -0400192For features for which a link:dev-design-docs.html[design,role=external,window=_blank]
193has been approved (see link:#design-driven-contribution-process[design-driven
Edwin Kempinf13dfa92019-05-02 13:55:43 +0200194contribution process]), contributors can gain the support of a mentor
195if they are committed to implement the feature.
196
Marco Miller50107212020-04-21 15:42:55 -0400197A link:dev-roles.html#mentor[mentor,role=external,window=_blank] helps with:
Edwin Kempinf13dfa92019-05-02 13:55:43 +0200198
199* doing timely reviews
200* providing technical guidance during code reviews
201* discussing details of the design
202* ensuring that the quality standards are met (well documented,
203 sufficient test coverage, backwards compatible etc.)
204
205A feature can have more than one mentor. To be able to deliver the
206promised support, at least one of the mentors must be a
Marco Miller50107212020-04-21 15:42:55 -0400207link:dev-roles.html#maintainer[maintainer,role=external,window=_blank].
Edwin Kempinf13dfa92019-05-02 13:55:43 +0200208
209Mentors are assigned by the link:dev-processes.html#steering-committee[
Marco Miller50107212020-04-21 15:42:55 -0400210steering committee,role=external,window=_blank]. To gain a mentor, ask for a
211mentor in the link:dev-design-doc-template.html#implementation-plan[Implementation
212Plan,role=external,window=_blank] section of the design doc or ask the steering
213committee after the design has been approved.
Edwin Kempinf13dfa92019-05-02 13:55:43 +0200214
215Mentors may not be available immediately. In this case, the steering
216committee should include the approved feature into the roadmap or
217prioritize it in the backlog. This way, it is transparent for the
218contributor when they can expect to be able to work on the feature with
219mentor support.
220
221Once the implementation phase starts, the contributor is expected to do
222the implementation in a timely manner.
223
224For every mentorship, the end must be clearly defined. The design doc
225must specify:
226
227* a maximum time frame for the mentorship, after which the mentorship
228 automatically ends, even if the feature is not done yet
229* done criteria that define when the feature is done and the mentorship
230 ends
231
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200232If a feature implementation is not completed in time and no contributors
233can commit to finishing the implementation, changes that have already been
234submitted for the feature may be reverted to avoid unused or half-finished
235code in the code base. In these circumstances, the steering committee
236determines how to proceed.
Martin Fick081fa512011-08-12 11:22:45 -0600237
Patrick Hieselc49eea22020-03-24 10:04:18 +0100238[[esc-dd-evaluation]]
239== How the ESC evaluates design documents
240This section describes how the ESC evaluates design documents. It’s
241meant as a guideline rather than being prescriptive for both ESC
242members and contributors.
243
244=== General Process
245As part of the design process, the ESC makes a final decision if a
246design gets to be implemented. If there are multiple alternative
247solutions, the ESC will decide which solution can be implemented.
248
249The ESC should wait until all contributors had the chance to
250voice their opinion in review comments or by proposing alternative
251solutions. Due to the infrequent ESC meetings (every 2-4 weeks)
252the ESC might discuss documents in cases where the discussion is
253already advanced far enough, but not make a decision yet. In this
254case, contributors can still voice concerns or discuss alternatives.
255The decision can be at the next meeting or via email in between
256meetings.
257
258=== Evaluation
259Product/Vision fit
Marco Miller1e543582020-04-07 16:58:59 -0400260
Patrick Hieselc49eea22020-03-24 10:04:18 +0100261Q: `Do we believe this feature belongs to Gerrit Code Review use-cases?`
Marco Miller1e543582020-04-07 16:58:59 -0400262
Patrick Hieselc49eea22020-03-24 10:04:18 +0100263* Yes: Customizable dashboards
264* No: UI for managing an LDAP server
265
266Q: `Is the proposed solution aligned with Gerrit’s vision?`
Marco Miller1e543582020-04-07 16:58:59 -0400267
Patrick Hieselc49eea22020-03-24 10:04:18 +0100268* Yes: Showing comments of older patch sets in newer patch sets to
269 keep track (core code review)
270* No: Implement a bug tracker in Gerrit (not core code review).
271
272=== Impact
273Q: `Will the new feature have a measurable, positive impact?`
Marco Miller1e543582020-04-07 16:58:59 -0400274
Patrick Hieselc49eea22020-03-24 10:04:18 +0100275* Yes: Increased productivity, faster/smoother workflow, etc.
276* Yes: Better latency, more reliable system.
277* No: Unclear impact or lacking metrics to measure.
278
279=== Complexity
280Q: `Can we support/maintain this feature once it is in Gerrit?`
Marco Miller1e543582020-04-07 16:58:59 -0400281
Patrick Hieselc49eea22020-03-24 10:04:18 +0100282* Yes: Code will fit into codebase, be well tested, easy to
283 understand.
284* No: Will add code or a workflow that is hard to understand
285 and easy to misinterpret.
Marco Miller1e543582020-04-07 16:58:59 -0400286
Patrick Hieselc49eea22020-03-24 10:04:18 +0100287Q: `Is the proposed feature or rework adding unnecessary complexity?`
Marco Miller1e543582020-04-07 16:58:59 -0400288
Patrick Hieselc49eea22020-03-24 10:04:18 +0100289* Yes: Adding a dependency on a well-supported library.
290* No: Adding a dependency on a library that is not widely used
291 or not actively maintained.
292
293=== Core vs. Plugin decision
294Q: `Would this fit better in a plugin?`
Marco Miller1e543582020-04-07 16:58:59 -0400295
Wendy Wang91d3b6e2022-05-12 14:41:01 +0200296* Yes: The proposed feature or rework is an implementation (e.g. Lucene
Patrick Hieselc49eea22020-03-24 10:04:18 +0100297 is an index implementation) of a generic concept that others
298 might want to implement differently.
299* Yes: The proposed feature or rework is very specific to a custom setup.
300* No: The proposed feature or rework is applicable to a wider user
301 base.
302* No: The proposed feature or rework is a `core code review feature`.
303
304=== Commitment
305Q: `Is someone willing to implement it?` (this question is
306especially important when reviewers propose alternative designs
307to the author’s own solution).
Marco Miller1e543582020-04-07 16:58:59 -0400308
Patrick Hieselc49eea22020-03-24 10:04:18 +0100309* Yes: The author or someone else commits to implementing the
310 proposed solution.
311* Yes: If a mentorship is required, a mentor is willing to help.
312* No: Unclear ownership, mentorship or implementation plan.
313
314=== Community
315Q: `If in doubt, is there a substantial benefit to a long-standing
316community member with many users?`
Marco Miller1e543582020-04-07 16:58:59 -0400317
Patrick Hieselc49eea22020-03-24 10:04:18 +0100318* The community shapes the future of Gerrit as a product. In
Marco Millerbe6a9d32020-04-07 16:33:32 -0400319 cases of doubt, the ESC can be more generous with long-standing
320 community members compared to `drive-by` contributions.
Patrick Hiesel078ad842020-03-24 10:04:18 +0100321
Martin Fick081fa512011-08-12 11:22:45 -0600322GERRIT
323------
324Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700325
326SEARCHBOX
327---------