devops: fix check_cdn.sh

This commit is contained in:
Andrey Lushnikov 2019-11-19 16:33:07 -08:00
parent 8a077da565
commit f77a50a8aa

View File

@ -2,6 +2,15 @@
set -e set -e
set +x set +x
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
HOST="https://playwrightaccount.blob.core.windows.net/builds" HOST="https://playwrightaccount.blob.core.windows.net/builds"
ARCHIVES=( ARCHIVES=(
"$HOST/firefox/%s/firefox-mac.zip" "$HOST/firefox/%s/firefox-mac.zip"
@ -28,23 +37,27 @@ GRN=$'\e[1;32m'
YEL=$'\e[1;33m' YEL=$'\e[1;33m'
END=$'\e[0m' END=$'\e[0m'
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
FFOX_REVISION=$(cat firefox/BUILD_NUMBER)
WK_REVISION=$(cat webkit/BUILD_NUMBER)
# Read start revision if there's any. # Read start revision if there's any.
REVISION=$(git rev-parse HEAD) REVISION=$FFOX_REVISION
if [[ $# == 1 ]]; then if (( FFOX_REVISION < WK_REVISION )); then
if ! git rev-parse $1; then REVISION=$WK_REVISION
echo "ERROR: there is no $REVISION in this repo - pull from upstream?"
exit 1
fi fi
REVISION=$(git rev-parse $1) if [[ $# == 1 ]]; then
REVISION=$1
fi fi
printf "%12s" "" printf "%7s" ""
for i in "${ALIASES[@]}"; do for i in "${ALIASES[@]}"; do
printf $COLUMN $i printf $COLUMN $i
done done
printf "\n" printf "\n"
while true; do while (( REVISION > 0 )); do
printf "%-12s" ${REVISION:0:10} printf "%-7s" ${REVISION}
for i in "${ARCHIVES[@]}"; do for i in "${ARCHIVES[@]}"; do
URL=$(printf $i $REVISION) URL=$(printf $i $REVISION)
if [[ $(curl -s -L -I $URL | head -1 | cut -f2 -d' ') == 200 ]]; then if [[ $(curl -s -L -I $URL | head -1 | cut -f2 -d' ') == 200 ]]; then
@ -54,5 +67,5 @@ while true; do
fi fi
done; done;
echo echo
REVISION=$(git rev-parse $REVISION^) REVISION=$((REVISION - 1 ))
done; done;