Skip to content

Commit

Permalink
Update Chromium and Firefox browsers to current latest versions.
Browse files Browse the repository at this point in the history
Also updates documentation to remove some bit rot and remove Angular-specific instructions.
  • Loading branch information
dgp1130 committed Aug 5, 2024
1 parent 2b34a13 commit 04194e2
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 117 deletions.
132 changes: 50 additions & 82 deletions tools/browsers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@
NOTE: Most of this directory was forked from
https://github.com/angular/dev-infra/tree/1ad20ef9dd457de967252283c1a968b0d702d0ae/bazel/browsers/.

Within the Angular organization, we use Chrome and Firefox to perform most of the local testing, and rely on Sauce Labs and BrowserStack to do cross-browser testing on our CI.
We use Chrome and Firefox to perform most end-to-end testing.

The version of Chrome used in tests within this monorepo is configured and controlled via Bazel and `puppeteer`.
We manually keep the configuration of these two tools in sync to create a consistent testing environment across unit, e2e, and integration tests.
The version of Chrome used in tests within this monorepo is configured and
controlled via Bazel.

## Bazel

Bazel `karma_web_test_suite` and `protractor_web_test_suite` targets will use Chromium or Firefox provisioned by `//tools/browsers`.
The version of Chrome and Firefox are specified in the `chromium.bzl` and `firefox.bzl` files in `/bazel/browsers`.
Bazel `jasmine_web_test_suite` targets will use Chromium or Firefox provisioned
by `//tools/browsers`. The version of Chrome and Firefox are specified in the
[`chromium.bzl`](./chromium/chromium.bzl) and
[`firefox.bzl`](./firefox/firefox.bzl) files.

The process of updating the Chrome or Firefox version is not straightforward, but below are dedicated sections for each browser.
The process of updating the Chrome or Firefox version is not straightforward,
but below are dedicated sections for each browser.

## Updating Chromium

1. Run `bazel run bazel/browsers/update-script find-latest-chromium-revision`
1. Run `bazel run //tools/browsers/update_script`

2. Inspect the console output which looks like the followed:
2. Inspect the console output which looks like the following:

```
Release Info: https://storage.googleapis.com/chromium-find-releases-static/index.html#r885453
Expand All @@ -42,50 +45,21 @@ LINUX: https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/8
```

3. Click on the `Release Info` URL and update version number comments in the `chromium.bzl` file so
that it is easier to figure out which version of Chromium is configured.
3. Click on the `Release Info` URL and update version number comments in the
[`chromium.bzl`](./chromium/chromium.bzl) file so that it is easier to
figure out which version of Chromium is configured.

4. Update the `chromium` and `chromedriver` repository URLs for all platforms to use the
new URLs printed out by the tool. Also make sure to update the SHA256 checksums. The tool prints the
new checksums for convenient copy & paste.

5. Update the dev-infra Google Cloud Storage mirror by running the following command.
You need to acquire a service key for the `dev-infra-gcs-manager` service account.

```bash
GOOGLE_APPLICATION_CREDENTIALS=<path-to-gcp-service-key> \
bazel run bazel/browsers/update-script upload-to-mirror chromium <revision-num>
```

Update the fallback `dev-infra-mirror` URLs for your browser archives to point to the newly
uploaded files (as printed by the script to the terminal output).

## Puppeteer

1. Visit https://github.com/puppeteer/puppeteer/blob/master/docs/api.md to determine which version of puppeteer corresponds to the version of Chrome desired.

2. Visit https://chromedriver.chromium.org/downloads to determine which version of ChromeDriver should be used for the version of Chrome desired.

> NOTE:
> The version of Chrome does not necessarily correspond exactly with the version of ChromeDriver.
> For example, you might have to use ChromeDriver v87.0.4280.x to drive Chrome v87.0.4272.x.
3. Update `scripts/puppeteer-chromedriver-versions.js` to include an entry with the new version of puppeteer as key and the new version of ChromeDriver as value (as determined in the two previous steps).

4. Update all of the puppeteer versions throughout the repo:

- `package.json`
- `aio/package.json`
- `aio/tools/examples/shared/package.json`

...and their corresponding `yarn.lock` files.
4. Update the `chromium` and `chromedriver` repository URLs for all platforms
to use the new URLs printed out by the tool. Also make sure to update the
SHA256 checksums. The tool prints the new checksums for convenient copy &
paste.

## Firefox

In order to update Firefox, open the `bazel/browsers/firefox/firefox.bzl` file and update the repository URLs to the desired version.
For example:
In order to update Firefox, open the [`firefox.bzl`](./firefox/firefox.bzl) file
and update the repository URLs to the desired version. For example:

```bzl
```python
platform_http_file(
name = "org_mozilla_firefox_amd64",
licenses = ["reciprocal"], # MPL 2.0
Expand All @@ -95,46 +69,40 @@ platform_http_file(
)
```

1. Go to the `urls` property and update the URL by replacing all `78.0` occurrences with the version you intend to use.
Once done, do the same change for other platforms (such as `macos`).
1. Go to the `urls` property and update the URL by replacing all `78.0`
occurrences with the version you intend to use. Once done, do the same
change for other platforms (such as `macos`).

2. Update the `sha256` checksum of the browser archives.
You can do this by downloading the artifacts from the URLs you just updated, and then running `shasum` on those files:
2. Update the `sha256` checksum of the browser archives. You can do this by
downloading the artifacts from the URLs you just updated, and then running
`shasum` on those files:

```sh
curl -L <BROWSER_URL> | shasum -a 256
```
```sh
curl -L <BROWSER_URL> | shasum -a 256
```

3. Go to https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html and find a version that is compatible with the version of Firefox being used.
3. Go to
https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html and
find a version that is compatible with the version of Firefox being used.

4. Update the `geckodriver` repository URLs to the desired version:
4. Update the `geckodriver` repository URLs to the desired version:

```bzl
platform_http_file(
name = "org_mozilla_geckodriver_amd64",
licenses = ["reciprocal"], # MPL 2.0
sha256 = "d59ca434d8e41ec1e30dd7707b0c95171dd6d16056fb6db9c978449ad8b93cc0",
# Geckodriver v0.26.0
urls = ["https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz"],
)
```
```python
platform_http_file(
name = "org_mozilla_geckodriver_amd64",
licenses = ["reciprocal"], # MPL 2.0
sha256 = "d59ca434d8e41ec1e30dd7707b0c95171dd6d16056fb6db9c978449ad8b93cc0",
# Geckodriver v0.26.0
urls = ["https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz"],
)
```

For example, replace all occurrences of `0.26.0` with the newer version.
For example, replace all occurrences of `0.26.0` with the newer version.

5. Update the `sha256` checksum of the driver archives.
You can do this by downloading the artifacts from the URLs you just updated, and then running `shasum` on those files:

```sh
curl -L <DRIVER_URL> | shasum -a 256
```

6. Update the dev-infra Google Cloud Storage mirror by running the following command.
You need to acquire a service key for the `dev-infra-gcs-manager` service account.

```bash
GOOGLE_APPLICATION_CREDENTIALS=<path-to-gcp-service-key> \
bazel run bazel/browsers/update-script upload-to-mirror firefox <version> <geckodriver-version>
```
5. Update the `sha256` checksum of the driver archives. You can do this by
downloading the artifacts from the URLs you just updated, and then running
`shasum` on those files:

Update the fallback `dev-infra-mirror` URLs for your browser archives to point to the newly
uploaded files (as printed by the script to the terminal output).
```sh
curl -L <DRIVER_URL> | shasum -a 256
```
40 changes: 20 additions & 20 deletions tools/browsers/chromium/chromium.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def define_chromium_repositories():
browser_archive(
name = "org_chromium_chromium_linux_x64",
licenses = ["notice"], # BSD 3-clause (maybe more?)
sha256 = "4e89a56b61db2fe494d4072d551b24e81833608318c5ba347b5d16a19687674e",
# 114.0.5673.0
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1121551/chrome-linux.zip"],
sha256 = "5c58e0e0e08e2e56ef34609195decc4898418a232c39d095db92e133facb3333",
# 127.0.6533.0
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1313161/chrome-linux.zip"],
named_files = {"CHROMIUM": "chrome-linux/chrome"},
# Exclude a log file that chromium writes to each run, causing remote
# cache misses.
Expand All @@ -24,9 +24,9 @@ def define_chromium_repositories():
browser_archive(
name = "org_chromium_chromium_macos_x64",
licenses = ["notice"], # BSD 3-clause (maybe more?)
sha256 = "c03e32f338dffee3404881b4950563d26812d0246c1372ad2f4800547382bb91",
# 114.0.5673.0
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Mac/1121551/chrome-mac.zip"],
sha256 = "bb95467ac4b4097833f707e58f079926a9cece4824c700da335c38081c7a4e5b",
# 127.0.6533.0
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Mac/1313161/chrome-mac.zip"],
named_files = {
"CHROMIUM": "chrome-mac/Chromium.app/Contents/MacOS/Chromium",
},
Expand All @@ -41,9 +41,9 @@ def define_chromium_repositories():
browser_archive(
name = "org_chromium_chromium_macos_arm64",
licenses = ["notice"], # BSD 3-clause (maybe more?)
sha256 = "4eb94b113fc995d20fafeca366b4b0cddf172ac1b2cdedc053464b764b74d1c0",
# 114.0.5673.0
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Mac_Arm/1121551/chrome-mac.zip"],
sha256 = "98173187fab109a1e3431806811e95bff38e61682bbeaf8776733b5a378515ab",
# 127.0.6533.0
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Mac_Arm/1313161/chrome-mac.zip"],
named_files = {
"CHROMIUM": "chrome-mac/Chromium.app/Contents/MacOS/Chromium",
},
Expand All @@ -58,9 +58,9 @@ def define_chromium_repositories():
browser_archive(
name = "org_chromium_chromium_windows",
licenses = ["notice"], # BSD 3-clause (maybe more?)
sha256 = "fdc221bb1e898ab851c4a5bc50ca1f88a5b388acb5510df4c4606c87d8be0230",
# 114.0.5673.0
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Win/1121551/chrome-win.zip"],
sha256 = "e95965510d85b2593c308469ae007c839c3dd2f777a7c2fb31b90bc80bf66897",
# 127.0.6533.0
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Win/1313161/chrome-win.zip"],
named_files = {"CHROMIUM": "chrome-win/chrome.exe"},
exclude_patterns = [
# Exclude files with spaces to prevent errors when symlinked as
Expand All @@ -78,9 +78,9 @@ def define_chromium_repositories():
# BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like),
# Academic Free License v. 2.0, BSD 2-clause, MIT
licenses = ["reciprocal"],
sha256 = "8b9823d07706db02d0f83189c7d658fff14796ccb07f3eac3b327f3f0230f6c7",
sha256 = "a138e7c9c52a4b1ca46e91a7079337c4ec0f7f30677a6ae3b8e112e441dd1ece",
urls = [
"https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1121551/chromedriver_linux64.zip",
"https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1313161/chromedriver_linux64.zip",
],
named_files = {"CHROMEDRIVER": "chromedriver_linux64/chromedriver"},
)
Expand All @@ -90,8 +90,8 @@ def define_chromium_repositories():
# BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like),
# Academic Free License v. 2.0, BSD 2-clause, MIT
licenses = ["reciprocal"],
sha256 = "1c66bd01e53ee406f9f30d5f9ccbf4ea0f9c0f1b959c6ace9758cf0d35a6e4b3",
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Mac/1121551/chromedriver_mac64.zip"],
sha256 = "c55271c4483511dc4432b0495a025a125c6b4979e8f88aeb299963fcb83f9473",
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Mac/1313161/chromedriver_mac64.zip"],
named_files = {"CHROMEDRIVER": "chromedriver_mac64/chromedriver"},
)

Expand All @@ -100,8 +100,8 @@ def define_chromium_repositories():
# BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like),
# Academic Free License v. 2.0, BSD 2-clause, MIT
licenses = ["reciprocal"],
sha256 = "7eba8dd97537ca787628ae11346e5c897473c0c0871df0fc4a313bd4a48a83dc",
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Mac_Arm/1121551/chromedriver_mac64.zip"],
sha256 = "772722afb0beeaf6cda1618590d5c6c5fef7358357bcb1002ca5f8c4afc5e5ca",
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Mac_Arm/1313161/chromedriver_mac64.zip"],
named_files = {"CHROMEDRIVER": "chromedriver_mac64/chromedriver"},
)

Expand All @@ -110,7 +110,7 @@ def define_chromium_repositories():
# BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like),
# Academic Free License v. 2.0, BSD 2-clause, MIT
licenses = ["reciprocal"],
sha256 = "db94b7f35041e3a76fa9a50808f196e61c27f43762df99526c1876244a196526",
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Win/1121551/chromedriver_win32.zip"],
sha256 = "f04ac0dc046b6e4bea1bde4a6ee07090f94e3e3b6ca804952392565abf626e15",
urls = ["https://storage.googleapis.com/chromium-browser-snapshots/Win/1313161/chromedriver_win32.zip"],
named_files = {"CHROMEDRIVER": "chromedriver_win32/chromedriver.exe"},
)
30 changes: 15 additions & 15 deletions tools/browsers/firefox/firefox.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,45 @@ def define_firefox_repositories():
browser_archive(
name = "org_mozilla_firefox_linux_x64",
licenses = ["reciprocal"], # MPL 2.0
sha256 = "3d0f74790fe6ff5e38324222ab0c47e10edb31970ed67c6dd7a1c84e7017d1a5",
# Firefox v97.0
urls = ["https://ftp.mozilla.org/pub/firefox/releases/97.0/linux-x86_64/en-US/firefox-97.0.tar.bz2"],
sha256 = "dce89cff7286c1bd4dd906fb9123e6136f1a1ecb7a6d674c53566c319cc85c4d",
# Firefox v128.0
urls = ["https://ftp.mozilla.org/pub/firefox/releases/128.0/linux-x86_64/en-US/firefox-128.0.tar.bz2"],
named_files = {"FIREFOX": "firefox/firefox"},
)

browser_archive(
# Firefox has a launcher that conditionally starts x64/arm64
name = "org_mozilla_firefox_macos",
licenses = ["reciprocal"], # MPL 2.0
sha256 = "c06c4e58179acaf55d05c3be41d0d4cdd68f811a75322a39557d91121aa2ef74",
# Firefox v97.0
urls = ["https://ftp.mozilla.org/pub/firefox/releases/97.0/mac/en-US/Firefox%2097.0.dmg"],
sha256 = "d0341bae660b826fdf6a352355f462495b9a64a3a7b0f953ab85025d6ddbda05",
# Firefox v128.0
urls = ["https://ftp.mozilla.org/pub/firefox/releases/128.0/mac/en-US/Firefox%20128.0.dmg"],
named_files = {"FIREFOX": "Firefox.app/Contents/MacOS/firefox"},
)

browser_archive(
name = "org_mozilla_geckodriver_linux_x64",
licenses = ["reciprocal"], # MPL 2.0
sha256 = "12c37f41d11ed982b7be43d02411ff2c75fb7a484e46966d000b47d1665baa88",
# Geckodriver v0.30.0
urls = ["https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz"],
sha256 = "79b2e77edd02c0ec890395140d7cdc04a7ff0ec64503e62a0b74f88674ef1313",
# Geckodriver v0.34.0
urls = ["https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz"],
named_files = {"GECKODRIVER": "geckodriver"},
)

browser_archive(
name = "org_mozilla_geckodriver_macos_x64",
licenses = ["reciprocal"], # MPL 2.0
sha256 = "560ba192666c1fe8796404153cfdf2d12551515601c4b3937aabcba6ee300f8c",
# Geckodriver v0.30.0
urls = ["https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-macos.tar.gz"],
sha256 = "9cec1546585b532959782c8220599aa97c1f99265bb2d75ad00cd56ef98f650c",
# Geckodriver v0.34.0
urls = ["https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-macos.tar.gz"],
named_files = {"GECKODRIVER": "geckodriver"},
)

browser_archive(
name = "org_mozilla_geckodriver_macos_arm64",
licenses = ["reciprocal"], # MPL 2.0
sha256 = "895bc2146edaea434d57a3b5d9a141be5cb3c5f8e8804916bd4869978ddfd4db",
# Geckodriver v0.30.0
urls = ["https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-macos-aarch64.tar.gz"],
sha256 = "d33232d29d764018d83e7e4e0c25ac274b5548658c605421c4373e64ba81d904",
# Geckodriver v0.34.0
urls = ["https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-macos-aarch64.tar.gz"],
named_files = {"GECKODRIVER": "geckodriver"},
)

0 comments on commit 04194e2

Please sign in to comment.