Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

devops: add poll_build.sh as an alternative to cronjob

Andrey Lushnikovc4763e841b2d
diff --git a/browser_patches/tools/poll_build.sh b/browser_patches/tools/poll_build.sh
new file mode 100755
index 0000000000..8f36fd24eb
--- /dev/null
+++ b/browser_patches/tools/poll_build.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+set -e
+set +x
+
+if [[ ($1 == '--help') || ($1 == '-h') ]]; then
+ echo "usage: $(basename $0) [firefox|webkit]"
+ echo
+ echo "Pull from upstream & run checkout_build_archive_upload.sh in a loop"
+fi
+
+if [[ $# == 0 ]]; then
+ echo "missing browser: 'firefox' or 'webkit'"
+ echo "try './$(basename $0) --help' for more information"
+ exit 1
+fi
+
+if [[ (-z $AZ_ACCOUNT_KEY) || (-z $AZ_ACCOUNT_NAME) ]]; then
+ echo "ERROR: Either \$AZ_ACCOUNT_KEY or \$AZ_ACCOUNT_NAME environment variable is missing."
+ echo " 'Azure Account Name' and 'Azure Account Key' secrets that are required"
+ echo " to upload builds ot Azure CDN."
+ exit 1
+fi
+
+if ! command -v az >/dev/null; then
+ echo "ERROR: az is not found in PATH"
+ exit 1
+fi
+
+BROWSER_NAME=""
+if [[ ("$1" == "firefox") || ("$1" == "firefox/") ]]; then
+ BROWSER_NAME="firefox"
+elif [[ ("$1" == "webkit") || ("$1" == "webkit/") ]]; then
+ BROWSER_NAME="webkit"
+else
+ echo ERROR: unknown browser - "$1"
+ exit 1
+fi
+
+# make sure the lockfile is removed when we exit and then claim it
+trap "cd $(pwd -P);" EXIT
+cd "$(dirname "$0")"
+
+# Check if git repo is dirty.
+if [[ -n $(git status -s) ]]; then
+ echo "ERROR: $FRIENDLY_CHECKOUT_PATH has dirty GIT state - commit everything and re-run the script."
+ exit 1
+fi
+
+while true; do
+ git pull origin master
+ ../checkout_build_archive_upload.sh $BROWSER_NAME
+ echo "------ Sleeping for 300 seconds before next turn... ------"
+ sleep 300
+done;
diff --git a/browser_patches/upload.sh b/browser_patches/upload.sh
index a3e8ce83d7..ee164a14ba 100755
--- a/browser_patches/upload.sh
+++ b/browser_patches/upload.sh
@@ -90,12 +90,12 @@ if ! [[ $ZIP_PATH == *.zip ]]; then
exit 1
fi
if [[ $(uname) == MINGW* ]]; then
- WIN_PATH=$({ cd $(dirname $ZIP_PATH) && pwd -W; } | sed 's|/|\\|g')
- WIN_PATH="${WIN_PATH}\\$(basename $ZIP_PATH)"
- echo $WIN_PATH
- az storage blob upload -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -f $WIN_PATH -n $BLOB_PATH
+ # Convert POSIX path to MSYS
+ WIN_PATH=$({ cd $(dirname $ZIP_PATH) && pwd -W; } | sed 's|/|\\|g')
+ WIN_PATH="${WIN_PATH}\\$(basename $ZIP_PATH)"
+ az storage blob upload -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -f $WIN_PATH -n $BLOB_PATH
else
- az storage blob upload -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -f $ZIP_PATH -n "$BLOB_PATH"
+ az storage blob upload -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -f $ZIP_PATH -n "$BLOB_PATH"
fi
echo "UPLOAD SUCCESSFUL!"