playwright/browser_patches/tools/check_cdn.sh
2019-11-20 18:02:36 -08:00

72 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -e
set +x
if [[ ($1 == '--help') || ($1 == '-h') ]]; then
echo "usage: $(basename $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
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'
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
FFOX_REVISION=$(cat ../firefox/BUILD_NUMBER)
WK_REVISION=$(cat ../webkit/BUILD_NUMBER)
REVISION=$FFOX_REVISION
if (( FFOX_REVISION < WK_REVISION )); then
REVISION=$WK_REVISION
fi
# Read start revision if there's any.
if [[ $# == 1 ]]; then
REVISION=$1
fi
printf "%7s" ""
for i in "${ALIASES[@]}"; do
printf $COLUMN $i
done
printf "\n"
while (( REVISION > 0 )); do
printf "%-7s" ${REVISION}
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
REVISION=$((REVISION - 1 ))
done;