Skip to content

Commit 8029680

Browse files
yjbanovditman
andauthored
[web] add a CIPD browser roller (Chromium only for now) (flutter#31740)
* [web] add a CIPD browser roller (Chromium only for now) Co-authored-by: David Iglesias Teixeira <ditman@gmail.com>
1 parent 3376b30 commit 8029680

File tree

7 files changed

+506
-81
lines changed

7 files changed

+506
-81
lines changed

lib/web_ui/README.md

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,54 @@ When running tests on LUCI using Chromium, LUCI uses the version of Chromium
135135
fetched from CIPD.
136136

137137
Since the engine code and infra recipes do not live in the same repository
138-
there are few steps to follow in order to upgrade a browser's version. For
139-
now these instructins are most relevant to Chrome.
138+
there are few steps to follow in order to upgrade a browser's version.
139+
140+
#### Chromium
141+
142+
Chromium is an independent project that gets rolled into Flutter manually, and as needed.
143+
Flutter consumes a pre-built Chromium version from chromium.org. When a new version of
144+
Chromium (check [here](https://www.chromium.org/getting-involved/download-chromium/#downloading-old-builds-of-chrome-chromium))
145+
is needed, follow these steps to roll the new version:
146+
147+
- Make sure you have `depot_tools` installed (if you are regularly hacking on
148+
the engine code, you probably do).
149+
- If not already authenticated with CIPD, run `cipd auth-login` and follow
150+
instructions (this step requires sufficient privileges; contact
151+
#hackers-infra-🌡 on [Flutter's Discord server](https://github.com/flutter/flutter/wiki/Chat)).
152+
- Edit `dev/browser_lock.yaml` and update the following values under `chrome`:
153+
- Set `Windows`, `Mac` and `Linux` to the `branch_base_position`s given [in this table](https://omahaproxy.appspot.com).
154+
(Pick from `linux`, `mac` and `win` as `os`, and the `stable` channel.)
155+
- Set `version` to a string composed of the Major Version of the browser, and
156+
the number of times that major version has been uploaded to CIPD. For example,
157+
start with `'99'` for version 99.0.4844.51 of Chromium, and update to `'99.1'`,
158+
`'99.2'` and so on if you need to upload newer bundles of the same major version.
159+
(This is required because tags can't be repeated in CIPD).
160+
- Run `dart dev/browser_roller.dart` and make sure it completes successfully.
161+
The script uploads the specified versions of Chromium (and Chromedriver) to the
162+
right locations in CIPD: [Chrome](https://chrome-infra-packages.appspot.com/p/flutter_internal/browsers/chrome),
163+
[Chromedriver](https://chrome-infra-packages.appspot.com/p/flutter_internal/browser-drivers/chrome).
164+
- Send a pull request containing the above file changes. Newer versions of Chromium
165+
might break some tests or Goldens. Get those fixed too!
166+
167+
If you have questions, contact the Flutter Web team on Flutter Discord on the
168+
\#hackers-web-🌍 channel.
169+
170+
##### **browser_roller.dart**
171+
172+
The script has the following command-line options:
173+
174+
- `--dry-run` - The script will stop before uploading artifacts to CIPD. The location of the data will be reported at the end of the script, if the script finishes successfullyThe output of the script will be visible in /tmp/browser-roll-RANDOM_STRING
175+
- `--verbose` - Greatly increase the amount of information printed to `stdout` by the script.
176+
177+
> Try the following!
178+
>
179+
> ```bash
180+
> dart ./dev/browser_roller.dart --dry-run --verbose
181+
> ```
182+
183+
#### **Other browsers / manual upload**
184+
185+
In general, the manual process goes like this:
140186
141187
1. Dowload the binaries for the new browser/driver for each operaing system
142188
(macOS, linux, windows).
@@ -147,11 +193,10 @@ now these instructins are most relevant to Chrome.
147193
148194
Resources:
149195
150-
1. For Chrome downloads [link][3].
151-
2. Browser and driver CIPD [packages][4] (required speciall access; ping
196+
1. Browser and driver CIPD [packages][4] (requires special access; ping
152197
hackers-infra on Discord for more information)
153-
3. LUCI web [recipe][5]
154-
4. More general reading on CIPD packages [link][6]
198+
2. LUCI web [recipe][5]
199+
3. More general reading on CIPD packages [link][6]
155200
156201
### Rolling CanvasKit
157202
@@ -222,7 +267,6 @@ FELT_USE_SNAPSHOT=false felt <command>
222267
223268
[1]: https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment
224269
[2]: https://github.com/flutter/engine/blob/main/lib/web_ui/dev/browser_lock.yaml
225-
[3]: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html
226270
[4]: https://chrome-infra-packages.appspot.com/p/flutter_internal
227-
[5]: https://flutter.googlesource.com/recipes/+/refs/heads/main/recipes/web_engine.py
271+
[5]: https://cs.opensource.google/flutter/recipes/+/master:recipes/engine/web_engine.py
228272
[6]: https://chromium.googlesource.com/chromium/src.git/+/main/docs/cipd_and_3pp.md#What-is-CIPD

lib/web_ui/dev/browser_lock.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ class ChromeLock {
4040
ChromeLock._fromYaml(YamlMap yaml) :
4141
linux = (yaml['Linux'] as int).toString(),
4242
mac = (yaml['Mac'] as int).toString(),
43-
windows = (yaml['Win'] as int).toString();
43+
windows = (yaml['Win'] as int).toString(),
44+
version = yaml['version'] as String;
4445

4546
final String linux;
4647
final String mac;
4748
final String windows;
49+
/// The major version of Chromium represented by this lock. E.g: '96' (for Chromium 96.0.554.51)
50+
final String version;
4851

49-
/// Return the version of Chromium to use for the current operating system.
52+
/// Return the Chromium Build ID to use for the current operating system.
5053
String get versionForCurrentPlatform {
5154
return PlatformBinding.instance.getChromeBuild(this);
5255
}

lib/web_ui/dev/browser_lock.yaml

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,55 @@
1-
# Please refer to the "Upgrade Browser Version" section in the README.md for
2-
# more details on how to update browser version numbers.
3-
chrome:
4-
# It seems Chrome can't always release from the same build for all operating
5-
# systems, so we specify per-OS build number.
6-
#
7-
# The OS names here must match what recipe Python expression
8-
# `self.m.platform.name.capitalize()` evaluates to. See:
9-
#
10-
# recipe_modules/web_util/api.py
11-
Linux: 927388 # Major version 96
12-
Mac: 927385 # Major version 96
13-
Win: 927369 # Major version 96
14-
15-
## Firefox does not use CIPD. To update the version, simply update it in this
16-
## file.
17-
firefox:
18-
version: '83.0'
19-
20-
edge:
21-
launcher_version: '1.2.0.0'
22-
23-
safari_ios:
24-
# Make sure this version is the same version supported by LUCI macOS bots.
25-
# XCode on these bots will be updated once a year, do not forget to update
26-
# `heightOfHeader` during this time.
27-
major_version: 13
28-
minor_version: 0
29-
device: 'iPhone 11'
30-
# `xcrun simctl` command is used to take screenshots. It takes the screenshot
31-
# of the entire simulator. Therefore we need to crop all the parts other than
32-
# the browsers' content. This file must be in sync with the local and LUCI
33-
# versions of macOS, iOS Simulator, and Xcode.
34-
# `heightOfHeader` is the number of pixels taken by the phone's header menu
35-
# and the browsers address bar.
36-
# TODO: https://github.com/flutter/flutter/issues/65672
37-
height_of_header: 189
38-
# `heightOfFooter` is the number of pixels taken by the phone's navigation
39-
# menu.
40-
height_of_footer: 250
41-
# Most of the time tests use a portion of the screen to compare goldens
42-
# instead of the entire screen. This area is reprented by a rectangle
43-
# when taking screenshots. However the rectangle dimensions are in logical
44-
# coordinates. In order to convert these coordinates to coordinates on the
45-
# phone screeen we enlarge or shrink the area by applying a linear
46-
# transformation by a scale_factor (a.k.a. we perform isotropic scaling).
47-
# This value will be differ depending on the phone.
48-
# For iOS 13.0 iPhone 11 Pro, this number is 1.15.
49-
scale_factor: 1.00
1+
# Please refer to the "Upgrade Browser Version" section in the README.md for
2+
# more details on how to update browser version numbers.
3+
chrome:
4+
# It seems Chrome can't always release from the same build for all operating
5+
# systems, so we specify per-OS build number.
6+
#
7+
# Follow these instructions to find the correct build number for a specific
8+
# Chromium version + OS combo:
9+
#
10+
# https://www.chromium.org/getting-involved/download-chromium/#downloading-old-builds-of-chrome-chromium
11+
#
12+
# The OS names here must match what recipe Python expression
13+
# `self.m.platform.name.capitalize()` evaluates to. See:
14+
#
15+
# recipe_modules/web_util/api.py
16+
Linux: 929514
17+
Mac: 929514
18+
Win: 929514
19+
version: '96.2' # CIPD tag for the above Build IDs. Normally "ChromeMajorVersion.UploadAttempt". ;)
20+
21+
## Firefox does not use CIPD. To update the version, simply update it in this
22+
## file.
23+
firefox:
24+
version: '83.0'
25+
26+
edge:
27+
launcher_version: '1.2.0.0'
28+
29+
safari_ios:
30+
# Make sure this version is the same version supported by LUCI macOS bots.
31+
# XCode on these bots will be updated once a year, do not forget to update
32+
# `heightOfHeader` during this time.
33+
major_version: 13
34+
minor_version: 0
35+
device: 'iPhone 11'
36+
# `xcrun simctl` command is used to take screenshots. It takes the screenshot
37+
# of the entire simulator. Therefore we need to crop all the parts other than
38+
# the browsers' content. This file must be in sync with the local and LUCI
39+
# versions of macOS, iOS Simulator, and Xcode.
40+
# `heightOfHeader` is the number of pixels taken by the phone's header menu
41+
# and the browsers address bar.
42+
# TODO: https://github.com/flutter/flutter/issues/65672
43+
height_of_header: 189
44+
# `heightOfFooter` is the number of pixels taken by the phone's navigation
45+
# menu.
46+
height_of_footer: 250
47+
# Most of the time tests use a portion of the screen to compare goldens
48+
# instead of the entire screen. This area is reprented by a rectangle
49+
# when taking screenshots. However the rectangle dimensions are in logical
50+
# coordinates. In order to convert these coordinates to coordinates on the
51+
# phone screeen we enlarge or shrink the area by applying a linear
52+
# transformation by a scale_factor (a.k.a. we perform isotropic scaling).
53+
# This value will be differ depending on the phone.
54+
# For iOS 13.0 iPhone 11 Pro, this number is 1.15.
55+
scale_factor: 1.00

0 commit comments

Comments
 (0)