playwright/browser_patches/check_cdn.sh
Andrey Lushnikov 8dc740570a
devops: refactor check_cdn.sh script (#5835)
Introduce `EXPECTED_BUILDS` list in each application folder and use
these lists when determining if all builds are ready.
2021-03-16 01:14:45 -07:00

42 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
set -e
set +x
if [[ ($1 == '--help') || ($1 == '-h') ]]; then
echo "usage: $(basename $0) [firefox|webkit|chromium|ffmpeg] [--full-history] [--has-all-builds]"
echo
echo "List CDN status for browser"
echo
exit 0
fi
if [[ $# == 0 ]]; then
echo "missing browser: 'firefox', 'webkit', 'chromium' or 'ffmpeg'"
echo "try './$(basename $0) --help' for more information"
exit 1
fi
trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
HOST="https://playwright2.blob.core.windows.net/builds"
BROWSER_NAME="$1"
if [[ (! -f "./${BROWSER_NAME}/BUILD_NUMBER") || (! -f "./${BROWSER_NAME}/EXPECTED_BUILDS") ]]; then
echo ERROR: unknown application - "$1"
exit 1
fi
REVISION=$(head -1 "./${BROWSER_NAME}/BUILD_NUMBER")
BUILD_NAMES="./${BROWSER_NAME}/EXPECTED_BUILDS"
for i in $(cat "${BUILD_NAMES}"); do
URL="${HOST}/${BROWSER_NAME}/${REVISION}/$i"
if ! [[ $(curl -s -L -I $URL | head -1 | cut -f2 -d' ') == 200 ]]; then
echo "${BROWSER_NAME} r${REVISION} is missing build: $i"
exit 1
fi
done;
echo "All expected builds are uploaded."