blob: 3f1e1411f4b729cf2adac6b86a8d97e836632094 [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
Ben Wagner96babd4c2022-08-26 16:53:09162Once the cherry-pick has landed a bot will apply the *merge-merged-##* label if
163the commit references the issue. If for some reason the commit did not
164reference the issue, add the *Merge-Merged-##* label to the issue. After the
165merge is completed the *Merge-Approved-##* label should be manually removed.
166
Alex Mineerc5b63022021-08-26 21:36:05167### Using Gerrit UI
Abdul Syede21aa1b2017-07-06 17:13:06168
David Benjamin58230aec2022-02-14 22:35:23169Select the "..." button in the Gerrit UI, then choose "Cherry Pick". When
Alex Mineerc5b63022021-08-26 21:36:05170prompted for a branch, enter *refs/branch-heads/####*, where #### corresponds
171to the release branch you are merging to (available on
mlcuieaa3e3952022-02-14 22:52:06172[Chromium Dash](https://chromiumdash.appspot.com/branches) in the "Chromium"
173column).
Abdul Syede21aa1b2017-07-06 17:13:06174
K. Moon216a9a1192022-08-26 06:02:36175Once the cherry-pick CL is prepared, you can bypass code review (but not
Xinyu Yang8bc1ba72022-11-04 05:01:11176OWNERS approval) within 14 days of the original change by adding the Rubber
K. Moon216a9a1192022-08-26 06:02:36177Stamper bot ([email protected]) as a reviewer. If the
178CL meets the
179[Rubber Stamper criteria](https://chromium.googlesource.com/infra/infra/+/refs/heads/main/go/src/infra/appengine/rubber-stamper/README.md),
180the bot will vote *Bot-Commit+1* to bypass code review. If the CL is marked
181*Auto-Submit+1*, the bot will also submit the CL to the CQ on your behalf.
Ian Barkley-Yeung3af975e2021-04-06 19:00:35182
Alex Mineerc5b63022021-08-26 21:36:05183### Using git
184
185The commands below should set up your environment to be able to successfully
186upload a cherry-pick to a release branch, where *####* corresponds to the
187release branch you are merging to (available on
mlcuieaa3e3952022-02-14 22:52:06188[Chromium Dash](https://chromiumdash.appspot.com/branches) in the "Chromium"
189column):
Alex Mineerc5b63022021-08-26 21:36:05190
191```
192$ gclient sync --with_branch_heads
193$ git fetch
194$ git checkout -b BRANCH_NAME refs/remotes/branch-heads/####
195$ git cl upstream branch-heads/####
196$ git cherry-pick -x COMMIT_HASH_MAIN
Yoav Weiss42be0432022-11-26 19:04:07197$ gclient sync
Alex Mineerc5b63022021-08-26 21:36:05198```
199
200From here, your environment should be ready to adjust the change as required;
201use ninja to build and test your changes, and when ready upload for review:
202
203```
204$ git cl upload
205```
206
207**Adjust the change description** to omit the "Change-Id: ..." line from
208original patch, otherwise you may experience issues when uploading the change
209to Gerrit. Once complete, use Gerrit to initiate review and approval of the
210merge as TBR has been discontinued.
211
212Other tips & tricks when merging with git via release branches:
213* Consider using multiple working directories when creating the release branch
214* Editing the change description to denote this is a merge (e.g. "Merge to
215 release branch" at the top) will help reviewers distinguish between the
216 cherry-pick and the original change
217
218## Merge automation
219
220The release team has built automation via
221[Sheriffbot](https://www.chromium.org/issue-tracking/autotriage) to assist in
222several merge flows: security merge triage, general merge request triage, and
223preventing missed merges.
224
225### Security merge triage
226
227Given the additional complexity inherent in security merges, the security team
228has built custom automation to handle this flow end to end; simply mark any
229security issue as *Fixed* and Sheriffbot will evaluate applicable milestones,
230determine if merges are required and automatically request them if need be.
231
232### Merge request triage
233
234To reduce release manager toil, Sheriffbot performs the first pass review of
235all merge requests; it may auto-approve the issue if it can detect the issue
236meets the right criteria for the current merge phase (e.g. a ReleaseBlock-Dev
237issue requesting a merge before beta promotion), and it may auto-reject the
238issue similarly (e.g. a Pri-3 issue requesting a merge post-stable). If it
239cannot decide, it will pass the issue to a release manager for manual review.
240
241Generally, Sheriffbot takes action on merge requests only after one of the two
242conditions below are met:
243
244* One or more changelists (via Gitwatcher) are present on the merge request
245 issue, and all changes have been landed for >= 24 hours
246* No changelists are present on the merge request issue, and the merge request
247 label has been applied for >= 24 hours
248
249These conditions help ensure any relevant changelists have had sufficient
250runtime in our canary channel and thus are low risk for introducing a new
251regression onto our release branch.
252
253### Preventing missed merges
254
255To avoid the situation where a critical issue is present on a release branch
256but the fix isn't merged, Sheriffbot evaluates all release-blocking issues
257targeting a milestone that has already branched and adds a *Merge-TBD-##* label
258if the issue was marked as fixed after branch day but hasn't been merged.
259When this occurs, developers should evaluate the issue and either request a
260merge if required (e.g. the fix did miss the release branch point) by adding
261the *Merge-Request-##* label, or add the *Merge-NA-##* label if not (e.g. the
262fix is present in the release branch already or the merge is unnecessary for
263other reasons).
264
265## Appendix
266
267### Merge criteria phases
268
269The table below describes the different phases that each milestone progresses
270through during its release cycle; this data is available via the
271Chromium Dash [front-end](https://chromiumdash.appspot.com/branches) and
272[API](https://chromiumdash.appspot.com/fetch_milestones).
273
274| Branch Phase | Period Begins | Period Ends | Acceptable Merges Include Fixes For: |
275|--------------------------|-----------------|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
276| 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) |
277| 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) |
278| 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:29279| 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 |
280| 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:05281
282### Merge states and labels
283
284The table below describes the different merge states and labels used to track
285them. All labels follow the form *Merge-[State]-##*, where ## corresponds to
286the applicable milestone. If multiple merges are required, these labels may
287appear multiple times on the same bug in different states (e.g. a merge request
288could have both *Merge-Approved-92* and *Merge-Rejected-91* at the same time).
289
290| Label / State | Step Owner | Next Steps |
291|---------------|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
292| Request | Release manager | Automation will review and either approve / reject directly, or pass the review to a release manager for manual evaluation |
293| Review | Release manager | Release manager will evaluate and either approve, reject, or request additional information within two business days |
294| Approved | Issue owner | Issue owner should cherry-pick the fix to the appropriate release branch ASAP |
295| Merged | None | N/A; merge has already been landed, no further work required for given milestone |
296| 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 |
297| 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:06298| NA | None | N/A; merge is not required to the relevant milestone, no further work required for given milestone |