blob: ce2499b9536e4400bd75a23e1160f6cc8effbecb [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)?
David Benjamin58230aec2022-02-14 22:35:231096. If this merge addresses a major issue in the stable channel, does it require
110 manual verification by the test team? If so, please describe required
111 testing.
Abdul Syede21aa1b2017-07-06 17:13:06112
Alex Mineerc5b63022021-08-26 21:36:05113## Monitoring merge requests
Abdul Syede21aa1b2017-07-06 17:13:06114
Alex Mineerc5b63022021-08-26 21:36:05115After you've applied the *Merge-Request-##* label, automation will evaluate
116your request and may either approve it, reject it, or pass it along to a
117release manager for manual evaluation; see [here](#merge-request-triage) to
118learn more about this automation. If manual review is required, release
119managers strive to answer all merge requests within two business days, but
120extenuating circumstances may cause delays.
Abdul Syede21aa1b2017-07-06 17:13:06121
Alex Mineerc5b63022021-08-26 21:36:05122At this point, following along via bug comments sent by email will always keep
123you in the loop, but you can also use the following saved project queries in
124Monorail (dropdown to the left of the search bar) to track your merges:
Abdul Syede21aa1b2017-07-06 17:13:06125
Alex Mineerc5b63022021-08-26 21:36:05126* [Approved and TBD merges](https://bugs.chromium.org/p/chromium/issues/list?q=owner%3Ame&can=41025836):
127 Merges that require your follow-up, either by landing the relevant
128 merge (if approved) or determining whether or not a merge is actually
129 required and if so, requesting it (if TBD)
130* [Requested merges](https://bugs.chromium.org/p/chromium/issues/list?q=owner%3Ame&can=41025837):
131 Merges that are waiting for input from release managers or automation; feel
132 free to ping bugs that sit in this queue for two business days (assuming you
133 verified that the change was already deployed to canary ahead of requesting a
134 merge)
135* [Rejected and NA merges](https://bugs.chromium.org/p/chromium/issues/list?q=owner%3Ame&can=41025838):
136 Merges that were either rejected by release managers, or not applicable to be
137 merged; generally, no action is needed for these items unless you disagree
138 with a merge's rejection and wish to escalate
139* [All merges](https://bugs.chromium.org/p/chromium/issues/list?q=owner%3Ame&can=41025839):
140 Includes every possible merge state, useful when wanting to find an item you
141 considered for merging but can't recall the state it was last in.
Abdul Syede21aa1b2017-07-06 17:13:06142
Alex Mineerc5b63022021-08-26 21:36:05143For a description of each label used to track the merge process, see the
144appendix [below](#merge-states-and-labels).
Abdul Syede21aa1b2017-07-06 17:13:06145
Alex Mineerc5b63022021-08-26 21:36:05146## Landing an approved merge
Abdul Syede21aa1b2017-07-06 17:13:06147
Alex Mineerc5b63022021-08-26 21:36:05148Once your merge has been approved for a given milestone (via the release
149manager or automation applying the *Merge-Approved-##* label), you have two
150options to land the merge:
Abdul Syede21aa1b2017-07-06 17:13:06151
Alex Mineerc5b63022021-08-26 21:36:05152* Gerrit UI, easiest for clean cherry-picks or those requiring only minor
153 changes
154* git, for more complex cherry-picks and / or when local verification may be
155 beneficial
Alan Cuttere338ed92021-05-06 04:57:19156
Alex Mineerc5b63022021-08-26 21:36:05157Regardless of which method you choose, please ensure you land your cherry-pick
158ASAP so that it can be included in the next release built from the branch; if
159you don't merge your cherry-pick soon after approval, it will eventually be
160rejected for merge.
Abdul Syede21aa1b2017-07-06 17:13:06161
Alex Mineerc5b63022021-08-26 21:36:05162### Using Gerrit UI
Abdul Syede21aa1b2017-07-06 17:13:06163
David Benjamin58230aec2022-02-14 22:35:23164Select the "..." button in the Gerrit UI, then choose "Cherry Pick". When
Alex Mineerc5b63022021-08-26 21:36:05165prompted for a branch, enter *refs/branch-heads/####*, where #### corresponds
166to the release branch you are merging to (available on
mlcuieaa3e3952022-02-14 22:52:06167[Chromium Dash](https://chromiumdash.appspot.com/branches) in the "Chromium"
168column).
Abdul Syede21aa1b2017-07-06 17:13:06169
Alex Mineerc5b63022021-08-26 21:36:05170Once the cherry-pick CL is prepared, you can have it approved and landed by
171adding Rubber Stamper ([email protected]) as a
Xinyu Yang12e42df2021-12-02 21:51:10172reviewer and setting Auto-Submit+1; the Rubber Stamper bot will approve by
173voting *Bot-Commit+1* label and submit the CL to CQ on your behalf.
174*Bot-Commit* is a label voted by bots to bypass code review.
Ian Barkley-Yeung3af975e2021-04-06 19:00:35175
Alex Mineerc5b63022021-08-26 21:36:05176*Note: the Rubber Stamper does not provide OWNERS approval, and only works
177within 7 days of the original change; Googlers can learn more
178[here](https://goto.google.com/rubber-stamper-user-guide).*
Ian Barkley-Yeung3af975e2021-04-06 19:00:35179
Alex Mineerc5b63022021-08-26 21:36:05180### Using git
181
182The commands below should set up your environment to be able to successfully
183upload a cherry-pick to a release branch, where *####* corresponds to the
184release branch you are merging to (available on
mlcuieaa3e3952022-02-14 22:52:06185[Chromium Dash](https://chromiumdash.appspot.com/branches) in the "Chromium"
186column):
Alex Mineerc5b63022021-08-26 21:36:05187
188```
189$ gclient sync --with_branch_heads
190$ git fetch
191$ git checkout -b BRANCH_NAME refs/remotes/branch-heads/####
192$ git cl upstream branch-heads/####
193$ git cherry-pick -x COMMIT_HASH_MAIN
194```
195
196From here, your environment should be ready to adjust the change as required;
197use ninja to build and test your changes, and when ready upload for review:
198
199```
200$ git cl upload
201```
202
203**Adjust the change description** to omit the "Change-Id: ..." line from
204original patch, otherwise you may experience issues when uploading the change
205to Gerrit. Once complete, use Gerrit to initiate review and approval of the
206merge as TBR has been discontinued.
207
208Other tips & tricks when merging with git via release branches:
209* Consider using multiple working directories when creating the release branch
210* Editing the change description to denote this is a merge (e.g. "Merge to
211 release branch" at the top) will help reviewers distinguish between the
212 cherry-pick and the original change
213
214## Merge automation
215
216The release team has built automation via
217[Sheriffbot](https://www.chromium.org/issue-tracking/autotriage) to assist in
218several merge flows: security merge triage, general merge request triage, and
219preventing missed merges.
220
221### Security merge triage
222
223Given the additional complexity inherent in security merges, the security team
224has built custom automation to handle this flow end to end; simply mark any
225security issue as *Fixed* and Sheriffbot will evaluate applicable milestones,
226determine if merges are required and automatically request them if need be.
227
228### Merge request triage
229
230To reduce release manager toil, Sheriffbot performs the first pass review of
231all merge requests; it may auto-approve the issue if it can detect the issue
232meets the right criteria for the current merge phase (e.g. a ReleaseBlock-Dev
233issue requesting a merge before beta promotion), and it may auto-reject the
234issue similarly (e.g. a Pri-3 issue requesting a merge post-stable). If it
235cannot decide, it will pass the issue to a release manager for manual review.
236
237Generally, Sheriffbot takes action on merge requests only after one of the two
238conditions below are met:
239
240* One or more changelists (via Gitwatcher) are present on the merge request
241 issue, and all changes have been landed for >= 24 hours
242* No changelists are present on the merge request issue, and the merge request
243 label has been applied for >= 24 hours
244
245These conditions help ensure any relevant changelists have had sufficient
246runtime in our canary channel and thus are low risk for introducing a new
247regression onto our release branch.
248
249### Preventing missed merges
250
251To avoid the situation where a critical issue is present on a release branch
252but the fix isn't merged, Sheriffbot evaluates all release-blocking issues
253targeting a milestone that has already branched and adds a *Merge-TBD-##* label
254if the issue was marked as fixed after branch day but hasn't been merged.
255When this occurs, developers should evaluate the issue and either request a
256merge if required (e.g. the fix did miss the release branch point) by adding
257the *Merge-Request-##* label, or add the *Merge-NA-##* label if not (e.g. the
258fix is present in the release branch already or the merge is unnecessary for
259other reasons).
260
261## Appendix
262
263### Merge criteria phases
264
265The table below describes the different phases that each milestone progresses
266through during its release cycle; this data is available via the
267Chromium Dash [front-end](https://chromiumdash.appspot.com/branches) and
268[API](https://chromiumdash.appspot.com/fetch_milestones).
269
270| Branch Phase | Period Begins | Period Ends | Acceptable Merges Include Fixes For: |
271|--------------------------|-----------------|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
272| 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) |
273| 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) |
274| 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) |
Alex Mineerb201d4a2021-11-04 22:30:29275| stable | M(X) Stable | M(X+1) Stable | Urgent new regressions (especially user reports), urgent release blockers, important security issues (medium severity or higher) requested by the security team |
276| extended (if applicable) | M(X+1) Stable | M(X+2) Stable | Important security issues (medium severity or higher) applicable to any platform supported by Chrome Browser requested by the security team |
Alex Mineerc5b63022021-08-26 21:36:05277
278### Merge states and labels
279
280The table below describes the different merge states and labels used to track
281them. All labels follow the form *Merge-[State]-##*, where ## corresponds to
282the applicable milestone. If multiple merges are required, these labels may
283appear multiple times on the same bug in different states (e.g. a merge request
284could have both *Merge-Approved-92* and *Merge-Rejected-91* at the same time).
285
286| Label / State | Step Owner | Next Steps |
287|---------------|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
288| Request | Release manager | Automation will review and either approve / reject directly, or pass the review to a release manager for manual evaluation |
289| Review | Release manager | Release manager will evaluate and either approve, reject, or request additional information within two business days |
290| Approved | Issue owner | Issue owner should cherry-pick the fix to the appropriate release branch ASAP |
291| Merged | None | N/A; merge has already been landed, no further work required for given milestone |
292| 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 |
293| 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) |
mlcuieaa3e3952022-02-14 22:52:06294| NA | None | N/A; merge is not required to the relevant milestone, no further work required for given milestone |