Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions script/install_chromium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,35 @@ readonly TARGET_DIR=$1
# The build of Chromium used to test web functionality.
#
# Chromium builds can be located here: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/
readonly CHROMIUM_BUILD=768968
# The ChromeDriver version corresponding to the build above. See
# https://chromedriver.chromium.org/downloads
# for versions mappings when updating Chromium.
readonly CHROME_DRIVER_VERSION=84.0.4147.30
#
# Check: https://github.com/flutter/engine/blob/master/lib/web_ui/dev/browser_lock.yaml
readonly CHROMIUM_BUILD=929514

# The correct ChromeDriver is distributed alongside the chromium build above, as
# `chromedriver_linux64.zip`, so no need to hardcode any extra info about it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know if this will be true in general going forward?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been true since February 2019:

But I don't have any guarantees that this is going to continue to be true in the future (but it's very convenient as is!). Let me ask in YAQS, see if anybody responds.

Copy link
Member Author

@ditman ditman Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found where it started to happen (it's mentioned as a "temporary" workaround):

https://bugs.chromium.org/p/chromedriver/issues/detail?id=2656#c15

The issue is currently assigned to a Googler, I'll try to reach out to them when they're back in the office.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been true since February 2019

That sounds like the kind of "temporary" that's not likely to change a lot, so it seems fine to depend on. It's not like it's hard to go back to the old approach if it's changed without something better (and it sounds like it would probably remain this way until there's something better).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if this assumption changes, we'd also need to change the CIPD roller script in the engine repo (but that thing only runs seldomly, this script would break much earlier)

readonly DOWNLOAD_ROOT="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F${CHROMIUM_BUILD}%2F"

# Install Chromium.
mkdir "$TARGET_DIR"
wget --no-verbose "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F${CHROMIUM_BUILD}%2Fchrome-linux.zip?alt=media" -O "$TARGET_DIR"/chromium.zip
unzip "$TARGET_DIR"/chromium.zip -d "$TARGET_DIR"/
readonly CHROMIUM_ZIP_FILE="$TARGET_DIR/chromium.zip"
wget --no-verbose "${DOWNLOAD_ROOT}chrome-linux.zip?alt=media" -O "$CHROMIUM_ZIP_FILE"
unzip -q "$CHROMIUM_ZIP_FILE" -d "$TARGET_DIR/"

# Install ChromeDriver.
readonly DRIVER_ZIP_FILE="$TARGET_DIR/chromedriver.zip"
wget --no-verbose "https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip" -O "$DRIVER_ZIP_FILE"
unzip "$DRIVER_ZIP_FILE" -d "$TARGET_DIR/chromedriver"
wget --no-verbose "${DOWNLOAD_ROOT}chromedriver_linux64.zip?alt=media" -O "$DRIVER_ZIP_FILE"
unzip -q "$DRIVER_ZIP_FILE" -d "$TARGET_DIR/"
# Rename TARGET_DIR/chromedriver_linux64 to the expected TARGET_DIR/chromedriver
mv -T "$TARGET_DIR/chromedriver_linux64" "$TARGET_DIR/chromedriver"

export CHROME_EXECUTABLE="$TARGET_DIR/chrome-linux/chrome"

# Echo info at the end for ease of debugging.
export CHROME_EXECUTABLE="$TARGET_DIR"/chrome-linux/chrome
echo $CHROME_EXECUTABLE
$CHROME_EXECUTABLE --version
echo "ChromeDriver $CHROME_DRIVER_VERSION"
set +x
echo
readonly CHROMEDRIVER_EXECUTABLE="$TARGET_DIR/chromedriver/chromedriver"
echo "$CHROME_EXECUTABLE"
"$CHROME_EXECUTABLE" --version
echo "$CHROMEDRIVER_EXECUTABLE"
"$CHROMEDRIVER_EXECUTABLE" --version
echo