[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
This commit is contained in:
Davide Maccarrone
2022-04-19 09:04:36 +02:00
committed by GitHub
parent ff63cfd072
commit 9364605355

View File

@@ -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