blob: 543ddbd9256132da76289cb16903819be54f69a3 [file] [log] [blame] [view]
Abdul Syede21aa1b2017-07-06 17:13:061# Merge Request Process
2
3[TOC]
4
5## tl;dr
6
Alex Mineerc5b63022021-08-26 21:36:057* Release managers (and delegates like the security team) must review all
8 merges made to release branches
9* Merge criteria become more strict as the stable release date approaches; use
10 Chromium Dash's [Branches page](https://chromiumdash.appspot.com/branches) to
11 understand which branches are active and what merges are acceptable for each
12 branch
13* Ensure your change is [safe to merge](#verifying-eligibility-and-safety)
14 before initiating the merge review process unless it's time-sensitive
15* Use Monorail's [project queries](#monitoring-merge-requests) to track your
16 approved merges as well as your pending requests
17* Use Gerrit or git to land your merge only after it's been approved
Abdul Syede21aa1b2017-07-06 17:13:0618
19## Introduction
20
Alex Mineerc5b63022021-08-26 21:36:0521Chromium is a main-first development team; generally, all code should land on
22main then roll out to stable users only after the milestone containing the code
23is branched, stabilized and shipped to the stable channel (to learn more about
24the release cycle, click
25[here](https://chromium.googlesource.com/chromium/src.git/+/main/docs/process/release_cycle.md)).
26This is because merging (also known as cherry-picking) code to an older release
27branch introduces risk and costs time across the team. However, there are times
28when the benefits outweigh the costs and a merge might be appropriate, e.g. to
29fix a web platform regression, address a crash or patch a security vulnerability.
Abdul Syede21aa1b2017-07-06 17:13:0630
Alex Mineerc5b63022021-08-26 21:36:0531To ensure we make the right decisions, release managers leverage a merge review
32process to evaluate each request. They'll ask questions about the reason you
33would like to merge a change and the risk of the merge itself, and you'll work
34together to make a judgement call on whether or not the merge should be
35approved or rejected.
Abdul Syede21aa1b2017-07-06 17:13:0636
Alex Mineerc5b63022021-08-26 21:36:0537Generally, merges follow these high-level steps:
Abdul Syede21aa1b2017-07-06 17:13:0638
Alex Mineerc5b63022021-08-26 21:36:0539* Developers update bug with relevant details and request a merge using the
40 *Merge-Request-##* label, then wait for review
41* Release managers and automation review and approve, reject, or ask
42 questions about the merge within two business days
43* Developers wait for review and, if approved, land the merge ASAP
Abdul Syede21aa1b2017-07-06 17:13:0644
Alex Mineerc5b63022021-08-26 21:36:0545For details on each step, see below.
Abdul Syede21aa1b2017-07-06 17:13:0646
Alex Mineerc5b63022021-08-26 21:36:0547**NOTE:** Because security issues (identified with *Type=Bug-Security*) follow
48a more complex flow, you may simply mark security issues as *Fixed* in Monorail
49and [automation](#security-merge-triage) will handle the remainder of the merge
50request process flow for you; simply process the merge if it is requested and
51approved.
Abdul Syede21aa1b2017-07-06 17:13:0652
Alex Mineerc5b63022021-08-26 21:36:0553## Requesting a merge
Abdul Syede21aa1b2017-07-06 17:13:0654
Alex Mineerc5b63022021-08-26 21:36:0555### Verifying eligibility and safety
Abdul Syede21aa1b2017-07-06 17:13:0656
Alex Mineerc5b63022021-08-26 21:36:0557Before requesting a merge, first ensure your change is a good merge candidate:
Abdul Syede21aa1b2017-07-06 17:13:0658
Alex Mineerc5b63022021-08-26 21:36:0559* Ensure it meets the merge criteria (via
60 [Chromium Dash](https://chromiumdash.appspot.com/branches)) of the branch(es)
61 you'd like to merge to; merge criteria become more strict the older the
62 branch is, more details on criteria [below](#merge-criteria-phases)
63* Verify merging the change to an older branch would be safe, e.g. unlikely to
64 introduce new regressions, no major merge conflicts, automated test coverage
65 present, etc; chat with your TL for input if you're not sure
66* Confirm your change fixes the issue at hand, preferably by testing on and
67 monitoring the canary channel for 24 hours post-release (see
68 [Chromium Dash](https://chromiumdash.appspot.com/commits) to determine if
69 your change has shipped)
Abdul Syede21aa1b2017-07-06 17:13:0670
Alex Mineerc5b63022021-08-26 21:36:0571 * You may skip this step if a release manager or security team member has
72 told you that the merge is urgent, e.g. is actively blocking a release
Alex Mineer40d33c32018-03-15 23:45:1473
Alex Mineerc5b63022021-08-26 21:36:0574### Updating crbug/
Abdul Syede21aa1b2017-07-06 17:13:0675
Alex Mineerc5b63022021-08-26 21:36:0576Next, ensure you have a crbug/ (generally the bug being fixed by the merge)
77with the following information present and accurate:
Abdul Syede21aa1b2017-07-06 17:13:0678
Alex Mineerc5b63022021-08-26 21:36:0579* Title and description clearly describing the bug being fixed
80* Priority (*Pri-#*), OS (*OS-OS*) and target milestone(s) (*Target-##*)
81* Owner, generally the person requesting / performing the merge
82* [Release block label](./release_blockers.md) if applicable
83 (*ReleaseBlock=Channel*)
84* Issue status:
Abdul Syede21aa1b2017-07-06 17:13:0685
Alex Mineerc5b63022021-08-26 21:36:0586 * Fixed: You're confident the issue is fixed on main, e.g. you've
87 locally built and tested the issue, no additional crash reports are
88 generated after the fix was released, etc (most issues)
89 * Assigned / Started: Diagnostic merges only, e.g. to merge code to track
90 down the root cause of an issue that only exists on branch
Abdul Syede21aa1b2017-07-06 17:13:0691
Alex Mineerc5b63022021-08-26 21:36:0592### Applying merge request label
Abdul Syede21aa1b2017-07-06 17:13:0693
Alex Mineerc5b63022021-08-26 21:36:0594Once you've verified all the above, you're ready to request a merge! Simply add
95the label *Merge-Request-##* to the issue (where ## indicates the milestone
96you'd like to merge to), and use multiple labels for multiple milestones, e.g.
97*Merge-Request-91 Merge-Request-92* for M91 and M92. Please also copy the
98following questions and answer them in a comment on the issue:
Alan Cuttercba85fbf2019-10-18 06:21:4799
Alex Mineerc5b63022021-08-26 21:36:051001. Why does your merge fit within the merge criteria for these milestones
101 ([Chrome Browser](https://chromiumdash.appspot.com/branches),
102 [Chrome OS](https://goto.google.com/cros-release-branch-merge-guidelines))?
1032. What changes specifically would you like to merge? Please link to Gerrit.
1043. Have the changes been released and tested on canary?
1054. Is this a new feature? If yes, is it behind a Finch flag and are
106 experiments active in any release channels?
1075. [Chrome OS only]: Was the change reviewed and approved by the
108 [Eng Prod Representative](https://goto.google.com/cros-engprodcomponents)?
Abdul Syede21aa1b2017-07-06 17:13:06109
Alex Mineerc5b63022021-08-26 21:36:05110## Monitoring merge requests
Abdul Syede21aa1b2017-07-06 17:13:06111
Alex Mineerc5b63022021-08-26 21:36:05112After you've applied the *Merge-Request-##* label, automation will evaluate
113your request and may either approve it, reject it, or pass it along to a
114release manager for manual evaluation; see [here](#merge-request-triage) to
115learn more about this automation. If manual review is required, release
116managers strive to answer all merge requests within two business days, but
117extenuating circumstances may cause delays.
Abdul Syede21aa1b2017-07-06 17:13:06118
Alex Mineerc5b63022021-08-26 21:36:05119At this point, following along via bug comments sent by email will always keep
120you in the loop, but you can also use the following saved project queries in
121Monorail (dropdown to the left of the search bar) to track your merges:
Abdul Syede21aa1b2017-07-06 17:13:06122
Alex Mineerc5b63022021-08-26 21:36:05123* [Approved and TBD merges](https://bugs.chromium.org/p/chromium/issues/list?q=owner%3Ame&can=41025836):
124 Merges that require your follow-up, either by landing the relevant
125 merge (if approved) or determining whether or not a merge is actually
126 required and if so, requesting it (if TBD)
127* [Requested merges](https://bugs.chromium.org/p/chromium/issues/list?q=owner%3Ame&can=41025837):
128 Merges that are waiting for input from release managers or automation; feel
129 free to ping bugs that sit in this queue for two business days (assuming you
130 verified that the change was already deployed to canary ahead of requesting a
131 merge)
132* [Rejected and NA merges](https://bugs.chromium.org/p/chromium/issues/list?q=owner%3Ame&can=41025838):
133 Merges that were either rejected by release managers, or not applicable to be
134 merged; generally, no action is needed for these items unless you disagree
135 with a merge's rejection and wish to escalate
136* [All merges](https://bugs.chromium.org/p/chromium/issues/list?q=owner%3Ame&can=41025839):
137 Includes every possible merge state, useful when wanting to find an item you
138 considered for merging but can't recall the state it was last in.
Abdul Syede21aa1b2017-07-06 17:13:06139
Alex Mineerc5b63022021-08-26 21:36:05140For a description of each label used to track the merge process, see the
141appendix [below](#merge-states-and-labels).
Abdul Syede21aa1b2017-07-06 17:13:06142
Alex Mineerc5b63022021-08-26 21:36:05143## Landing an approved merge
Abdul Syede21aa1b2017-07-06 17:13:06144
Alex Mineerc5b63022021-08-26 21:36:05145Once your merge has been approved for a given milestone (via the release
146manager or automation applying the *Merge-Approved-##* label), you have two
147options to land the merge:
Abdul Syede21aa1b2017-07-06 17:13:06148
Alex Mineerc5b63022021-08-26 21:36:05149* Gerrit UI, easiest for clean cherry-picks or those requiring only minor
150 changes
151* git, for more complex cherry-picks and / or when local verification may be
152 beneficial
Alan Cuttere338ed92021-05-06 04:57:19153
Alex Mineerc5b63022021-08-26 21:36:05154Regardless of which method you choose, please ensure you land your cherry-pick
155ASAP so that it can be included in the next release built from the branch; if
156you don't merge your cherry-pick soon after approval, it will eventually be
157rejected for merge.
Abdul Syede21aa1b2017-07-06 17:13:06158
Alex Mineerc5b63022021-08-26 21:36:05159### Using Gerrit UI
Abdul Syede21aa1b2017-07-06 17:13:06160
Alex Mineerc5b63022021-08-26 21:36:05161Select the "More" button in the Gerrit UI, then choose "Cherry Pick". When
162prompted for a branch, enter *refs/branch-heads/####*, where #### corresponds
163to the release branch you are merging to (available on
164[Chromium Dash](https://chromiumdash.appspot.com/branches)).
Abdul Syede21aa1b2017-07-06 17:13:06165
Alex Mineerc5b63022021-08-26 21:36:05166Once the cherry-pick CL is prepared, you can have it approved and landed by
167adding Rubber Stamper ([email protected]) as a
168reviewer and setting Auto-Submit+1;the Rubber Stamper bot will approve and
169submit the CL to CQ on your behalf.
Ian Barkley-Yeung3af975e2021-04-06 19:00:35170
Alex Mineerc5b63022021-08-26 21:36:05171*Note: the Rubber Stamper does not provide OWNERS approval, and only works
172within 7 days of the original change; Googlers can learn more
173[here](https://goto.google.com/rubber-stamper-user-guide).*
Ian Barkley-Yeung3af975e2021-04-06 19:00:35174
Alex Mineerc5b63022021-08-26 21:36:05175### Using git
176
177The commands below should set up your environment to be able to successfully
178upload a cherry-pick to a release branch, where *####* corresponds to the
179release branch you are merging to (available on
180[Chromium Dash](https://chromiumdash.appspot.com/branches)):
181
182```
183$ gclient sync --with_branch_heads
184$ git fetch
185$ git checkout -b BRANCH_NAME refs/remotes/branch-heads/####
186$ git cl upstream branch-heads/####
187$ git cherry-pick -x COMMIT_HASH_MAIN
188```
189
190From here, your environment should be ready to adjust the change as required;
191use ninja to build and test your changes, and when ready upload for review:
192
193```
194$ git cl upload
195```
196
197**Adjust the change description** to omit the "Change-Id: ..." line from
198original patch, otherwise you may experience issues when uploading the change
199to Gerrit. Once complete, use Gerrit to initiate review and approval of the
200merge as TBR has been discontinued.
201
202Other tips & tricks when merging with git via release branches:
203* Consider using multiple working directories when creating the release branch
204* Editing the change description to denote this is a merge (e.g. "Merge to
205 release branch" at the top) will help reviewers distinguish between the
206 cherry-pick and the original change
207
208## Merge automation
209
210The release team has built automation via
211[Sheriffbot](https://www.chromium.org/issue-tracking/autotriage) to assist in
212several merge flows: security merge triage, general merge request triage, and
213preventing missed merges.
214
215### Security merge triage
216
217Given the additional complexity inherent in security merges, the security team
218has built custom automation to handle this flow end to end; simply mark any
219security issue as *Fixed* and Sheriffbot will evaluate applicable milestones,
220determine if merges are required and automatically request them if need be.
221
222### Merge request triage
223
224To reduce release manager toil, Sheriffbot performs the first pass review of
225all merge requests; it may auto-approve the issue if it can detect the issue
226meets the right criteria for the current merge phase (e.g. a ReleaseBlock-Dev
227issue requesting a merge before beta promotion), and it may auto-reject the
228issue similarly (e.g. a Pri-3 issue requesting a merge post-stable). If it
229cannot decide, it will pass the issue to a release manager for manual review.
230
231Generally, Sheriffbot takes action on merge requests only after one of the two
232conditions below are met:
233
234* One or more changelists (via Gitwatcher) are present on the merge request
235 issue, and all changes have been landed for >= 24 hours
236* No changelists are present on the merge request issue, and the merge request
237 label has been applied for >= 24 hours
238
239These conditions help ensure any relevant changelists have had sufficient
240runtime in our canary channel and thus are low risk for introducing a new
241regression onto our release branch.
242
243### Preventing missed merges
244
245To avoid the situation where a critical issue is present on a release branch
246but the fix isn't merged, Sheriffbot evaluates all release-blocking issues
247targeting a milestone that has already branched and adds a *Merge-TBD-##* label
248if the issue was marked as fixed after branch day but hasn't been merged.
249When this occurs, developers should evaluate the issue and either request a
250merge if required (e.g. the fix did miss the release branch point) by adding
251the *Merge-Request-##* label, or add the *Merge-NA-##* label if not (e.g. the
252fix is present in the release branch already or the merge is unnecessary for
253other reasons).
254
255## Appendix
256
257### Merge criteria phases
258
259The table below describes the different phases that each milestone progresses
260through during its release cycle; this data is available via the
261Chromium Dash [front-end](https://chromiumdash.appspot.com/branches) and
262[API](https://chromiumdash.appspot.com/fetch_milestones).
263
264| Branch Phase | Period Begins | Period Ends | Acceptable Merges Include Fixes For: |
265|--------------------------|-----------------|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
266| branch | M(X) Branch | M(X) Beta | Polish issues for Finch-gated features (no workflow changes), any new regressions, any release blockers, any security issues, any string issues (.GRD changes) |
267| beta | M(X) Beta | M(X) Stable Cut | Non-functional issues for Finch-gated features (e.g. add metrics, fix crash), noticeable new regressions, any release blockers, any security issues, urgent string issues (.GRD changes) |
268| stable_cut | M(X) Stable Cut | M(X) Stable | Urgent new regressions, all release blockers, important security issues (medium severity or higher), emergency string issues (.GRD changes) |
269| stable | M(X) Stable | M(X+1) Stable | Urgent new regressions (especially user reports), urgent release blockers, important security issues (medium severity or higher) |
270| extended (if applicable) | M(X+1) Stable | M(X+2) Stable | Important security issues (medium severity or higher) applicable to Windows, Mac or Chrome OS |
271
272### Merge states and labels
273
274The table below describes the different merge states and labels used to track
275them. All labels follow the form *Merge-[State]-##*, where ## corresponds to
276the applicable milestone. If multiple merges are required, these labels may
277appear multiple times on the same bug in different states (e.g. a merge request
278could have both *Merge-Approved-92* and *Merge-Rejected-91* at the same time).
279
280| Label / State | Step Owner | Next Steps |
281|---------------|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
282| Request | Release manager | Automation will review and either approve / reject directly, or pass the review to a release manager for manual evaluation |
283| Review | Release manager | Release manager will evaluate and either approve, reject, or request additional information within two business days |
284| Approved | Issue owner | Issue owner should cherry-pick the fix to the appropriate release branch ASAP |
285| Merged | None | N/A; merge has already been landed, no further work required for given milestone |
286| Rejected | Issue owner | Issue owner should re-add *Merge-Request-##* to escalate if they feel the merge was erroneously rejected and should be re-evaluated |
287| TBD | Issue owner | Issue owner should evaluate if a merge is required, then remove *Merge-TBD-##* and replace it with *Merge-NA-##* (if no merge needed) or *Merge-Request-##* (if merge needed) |
288| NA | None | N/A; merge is not required to the relevant milestone, no further work required for given milestone |