From 9364605355051aa302a3005ea262de8d8080726c Mon Sep 17 00:00:00 2001 From: Davide Maccarrone Date: Tue, 19 Apr 2022 09:04:36 +0200 Subject: [PATCH] [Ubuntu] Pull previous version of Chromium if revision is 4 digits long (#5407) * pull previous version of chromium if revision is 4 digits long * add example revisions that break build * use json instead of csv when retrieving previous versions * grab revision, not version --- images/linux/scripts/installers/google-chrome.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 3fb2a019..29ad946e 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -14,10 +14,14 @@ function GetChromiumRevision { URL="https://omahaproxy.appspot.com/deps.json?version=${CHROME_VERSION}" REVISION=$(curl -s $URL | jq -r '.chromium_base_position') - # Google chrome 99.0.4844.82 based on the 1060 chromium revision, but there is chromium release with such number, use the previous release for that case - # https://github.com/actions/virtual-environments/issues/5256 - if [ $REVISION -eq "1060" ]; then - REVISION="961656" + # Some Google Chrome versions are based on Chromium revisions for which a (usually very old) Chromium release with the same number exist. So far this has heppened with 4 digits long Chromium revisions (1060, 1086). + # Use the previous Chromium release when this happens to avoid downloading and installing very old Chromium releases that would break image build because of incompatibilities. + # First reported with: https://github.com/actions/virtual-environments/issues/5256 + if [ ${#REVISION} -eq 4 ]; then + CURRENT_REVISIONS=$(curl -s "https://omahaproxy.appspot.com/all.json?os=linux&channel=stable") + PREVIOUS_VERSION=$(echo "$CURRENT_REVISIONS" | jq -r '.[].versions[].previous_version') + URL="https://omahaproxy.appspot.com/deps.json?version=${PREVIOUS_VERSION}" + REVISION=$(curl -s $URL | jq -r '.chromium_base_position') fi # Take the first part of the revision variable to search not only for a specific version, # but also for similar ones, so that we can get a previous one if the required revision is not found