playwright/browser_patches/check_cdn.sh

72 lines
1.4 KiB
Bash
Raw Normal View History

2019-11-19 05:18:28 +03:00
#!/bin/bash
set -e
set +x
2019-11-20 03:33:07 +03:00
if [[ ($1 == '--help') || ($1 == '-h') ]]; then
echo "usage: $0 [revision-to-start]"
echo
echo "List CDN status for browser revisions"
echo "Pass optional |revision-to-start| to limit revision search"
exit 0
fi
2019-11-19 05:18:28 +03:00
HOST="https://playwrightaccount.blob.core.windows.net/builds"
ARCHIVES=(
"$HOST/firefox/%s/firefox-mac.zip"
"$HOST/firefox/%s/firefox-linux.zip"
"$HOST/firefox/%s/firefox-win.zip"
"$HOST/webkit/%s/minibrowser-linux.zip"
"$HOST/webkit/%s/minibrowser-mac10.14.zip"
"$HOST/webkit/%s/minibrowser-mac10.15.zip"
)
ALIASES=(
"FF-MAC"
"FF-LINUX"
"FF-WIN"
"WK-MAC-10.14"
"WK-MAC-10.15"
"WK-LINUX"
)
COLUMN="%-15s"
# COLORS
RED=$'\e[1;31m'
GRN=$'\e[1;32m'
YEL=$'\e[1;33m'
END=$'\e[0m'
2019-11-20 03:33:07 +03:00
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
FFOX_REVISION=$(cat firefox/BUILD_NUMBER)
WK_REVISION=$(cat webkit/BUILD_NUMBER)
2019-11-19 05:18:28 +03:00
# Read start revision if there's any.
2019-11-20 03:33:07 +03:00
REVISION=$FFOX_REVISION
if (( FFOX_REVISION < WK_REVISION )); then
REVISION=$WK_REVISION
fi
2019-11-19 05:18:28 +03:00
if [[ $# == 1 ]]; then
2019-11-20 03:33:07 +03:00
REVISION=$1
2019-11-19 05:18:28 +03:00
fi
2019-11-20 03:33:07 +03:00
printf "%7s" ""
2019-11-19 05:18:28 +03:00
for i in "${ALIASES[@]}"; do
printf $COLUMN $i
done
printf "\n"
2019-11-20 03:33:07 +03:00
while (( REVISION > 0 )); do
printf "%-7s" ${REVISION}
2019-11-19 05:18:28 +03:00
for i in "${ARCHIVES[@]}"; do
URL=$(printf $i $REVISION)
if [[ $(curl -s -L -I $URL | head -1 | cut -f2 -d' ') == 200 ]]; then
printf ${GRN}$COLUMN${END} "YES"
else
printf ${RED}$COLUMN${END} "NO"
fi
done;
echo
2019-11-20 03:33:07 +03:00
REVISION=$((REVISION - 1 ))
2019-11-19 05:18:28 +03:00
done;