devops: rewrite checkout_build_archive_upload with build flavors

This patch establishes the following convention:
- scripts `checkout_build_archive_upload.sh` and `upload.sh` now accept
  build flavor instead of browser name. Build flavor fully defines the
  build produced / uploaded.
- scripts under `//browser_patches/webkit` and
  `//browser_patches/firefox` produce build that is specific to the host
  system.
This commit is contained in:
Andrey Lushnikov 2020-01-17 14:23:31 -08:00
parent fc9ddb7c3c
commit 9a944db53f
6 changed files with 91 additions and 68 deletions

View File

@ -55,7 +55,7 @@ if [[ -n $(git status -s) ]]; then
fi fi
git pull origin master git pull origin master
../checkout_build_archive_upload.sh firefox >/tmp/$(basename $0)-firefox-log.log || true ../checkout_build_archive_upload.sh firefox-linux >/tmp/$(basename $0)--firefox-linux.log || true
git pull origin master git pull origin master
../checkout_build_archive_upload.sh webkit >/tmp/$(basename $0)-webkit-log.log || true ../checkout_build_archive_upload.sh webkit-gtk >/tmp/$(basename $0)--webkit-gtk.log || true

View File

@ -61,7 +61,7 @@ if [[ -n $(git status -s) ]]; then
fi fi
git pull origin master git pull origin master
../checkout_build_archive_upload.sh firefox >/tmp/$(basename $0)-firefox-log.log || true ../checkout_build_archive_upload.sh firefox-mac >/tmp/$(basename $0)--firefox-mac.log || true
git pull origin master git pull origin master
../checkout_build_archive_upload.sh webkit >/tmp/$(basename $0)-webkit-log.log || true ../checkout_build_archive_upload.sh webkit-mac-10.14 >/tmp/$(basename $0)--webkit-mac-10.14.log || true

View File

@ -62,4 +62,4 @@ if [[ -n $(git status -s) ]]; then
fi fi
git pull origin master git pull origin master
../checkout_build_archive_upload.sh webkit >/tmp/$(basename $0)-webkit-log.log || true ../checkout_build_archive_upload.sh webkit-mac-10.15 >/tmp/$(basename $0)--webkit-mac-10.15.log || true

View File

@ -45,9 +45,9 @@ while true; do
iteration=$(( iteration + 1 )) iteration=$(( iteration + 1 ))
echo "== ITERATION ${iteration} ==" echo "== ITERATION ${iteration} =="
git pull origin master git pull origin master
../checkout_build_archive_upload.sh webkit || true ../checkout_build_archive_upload.sh webkit-win64 || true
git pull origin master git pull origin master
../checkout_build_archive_upload.sh firefox || true ../checkout_build_archive_upload.sh firefox-win32 || true
git pull origin master git pull origin master
../checkout_build_archive_upload.sh firefox-win64 || true ../checkout_build_archive_upload.sh firefox-win64 || true
newTimestamp=$(date +%s) newTimestamp=$(date +%s)

View File

@ -3,7 +3,7 @@ set -e
set +x set +x
if [[ ($1 == '--help') || ($1 == '-h') ]]; then if [[ ($1 == '--help') || ($1 == '-h') ]]; then
echo "usage: $(basename $0) [firefox|firefox-win64|webkit] [-f|--force]" echo "usage: $(basename $0) [firefox-linux|firefox-win32|firefox-win64|webkit-gtk|webkit-win64|webkit-mac-10.14|webkit-mac-10.15] [-f|--force]"
echo echo
echo "Prepares checkout under browser folder, applies patches, builds, archives, and uploades if build is missing." echo "Prepares checkout under browser folder, applies patches, builds, archives, and uploades if build is missing."
echo "Script will bail out early if the build for the browser version is already present." echo "Script will bail out early if the build for the browser version is already present."
@ -15,22 +15,66 @@ if [[ ($1 == '--help') || ($1 == '-h') ]]; then
fi fi
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
echo "missing browser: 'firefox' or 'webkit'" echo "missing build flavor!"
echo "try './$(basename $0) --help' for more information" echo "try './$(basename $0) --help' for more information"
exit 1 exit 1
fi fi
CURRENT_HOST_OS="$(uname)"
CURRENT_HOST_OS_VERSION=""
if [[ "$CURRENT_HOST_OS" == "Darwin" ]]; then
CURRENT_HOST_OS_VERSION=$(sw_vers -productVersion | grep -o '^\d\+.\d\+')
fi
BROWSER_NAME="" BROWSER_NAME=""
EXTRA_BUILD_ARGS="" EXTRA_BUILD_ARGS=""
if [[ ("$1" == "firefox") || ("$1" == "firefox/") ]]; then BUILD_FLAVOR="$1"
EXPECTED_HOST_OS=""
EXPECTED_HOST_OS_VERSION=""
if [[ "$BUILD_FLAVOR" == "firefox-linux" ]]; then
BROWSER_NAME="firefox" BROWSER_NAME="firefox"
elif [[ ("$1" == "firefox-win64") || ("$1" == "firefox-win64/") ]]; then EXPECTED_HOST_OS="Linux"
elif [[ "$BUILD_FLAVOR" == "firefox-mac" ]]; then
BROWSER_NAME="firefox"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="10.14"
elif [[ "$BUILD_FLAVOR" == "firefox-win32" ]]; then
BROWSER_NAME="firefox"
EXPECTED_HOST_OS="MINGW"
elif [[ "$BUILD_FLAVOR" == "firefox-win64" ]]; then
BROWSER_NAME="firefox" BROWSER_NAME="firefox"
EXTRA_BUILD_ARGS="--win64" EXTRA_BUILD_ARGS="--win64"
elif [[ ("$1" == "webkit") || ("$1" == "webkit/") ]]; then EXPECTED_HOST_OS="MINGW"
elif [[ "$BUILD_FLAVOR" == "webkit-gtk" ]]; then
BROWSER_NAME="webkit" BROWSER_NAME="webkit"
EXPECTED_HOST_OS="Linux"
elif [[ "$BUILD_FLAVOR" == "webkit-win64" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="MINGW"
elif [[ "$BUILD_FLAVOR" == "webkit-mac-10.14" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="10.14"
elif [[ "$BUILD_FLAVOR" == "webkit-mac-10.15" ]]; then
BROWSER_NAME="webkit"
EXPECTED_HOST_OS="Darwin"
EXPECTED_HOST_OS_VERSION="10.15"
else else
echo ERROR: unknown browser - "$1" echo ERROR: unknown build flavor - "$BUILD_FLAVOR"
exit 1
fi
if [[ "$CURRENT_HOST_OS" != $EXPECTED_HOST_OS* ]]; then
echo "ERROR: cannot build $BUILD_FLAVOR"
echo " -- expected OS: $EXPECTED_HOST_OS"
echo " -- current OS: $CURRENT_HOST_OS"
exit 1
fi
if [[ "$CURRENT_HOST_OS_VERSION" != "$EXPECTED_HOST_OS_VERSION" ]]; then
echo "ERROR: cannot build $BUILD_FLAVOR"
echo " -- expected OS Version: $EXPECTED_HOST_OS_VERSION"
echo " -- current OS Version: $CURRENT_HOST_OS_VERSION"
exit 1 exit 1
fi fi
@ -50,7 +94,7 @@ BUILD_NUMBER=$(cat ./$BROWSER_NAME/BUILD_NUMBER)
# pull from upstream and check if a new build has to be uploaded. # pull from upstream and check if a new build has to be uploaded.
if ! [[ ($2 == '-f') || ($2 == '--force') ]]; then if ! [[ ($2 == '-f') || ($2 == '--force') ]]; then
if ./upload.sh $1 --check; then if ./upload.sh $BUILD_FLAVOR --check; then
echo "Build is already uploaded - no changes." echo "Build is already uploaded - no changes."
exit 0 exit 0
else else
@ -69,7 +113,7 @@ cd -
source ./buildbots/send_telegram_message.sh source ./buildbots/send_telegram_message.sh
LAST_COMMIT_MESSAGE=$(git log --format=%s -n 1 HEAD -- ./$BROWSER_NAME/BUILD_NUMBER) LAST_COMMIT_MESSAGE=$(git log --format=%s -n 1 HEAD -- ./$BROWSER_NAME/BUILD_NUMBER)
BUILD_ALIAS="<b>[[$(./upload.sh $1 --show-alias)]]</b> $LAST_COMMIT_MESSAGE" BUILD_ALIAS="<b>[[$BUILD_FLAVOR r$BUILD_NUMBER]]</b> $LAST_COMMIT_MESSAGE"
send_telegram_message "$BUILD_ALIAS -- started ⏳" send_telegram_message "$BUILD_ALIAS -- started ⏳"
echo "-- preparing checkout" echo "-- preparing checkout"
@ -97,7 +141,7 @@ if ! ./$BROWSER_NAME/archive.sh $ZIP_PATH; then
fi fi
echo "-- uploading" echo "-- uploading"
if ! ./upload.sh $1 $ZIP_PATH; then if ! ./upload.sh $BUILD_FLAVOR $ZIP_PATH; then
send_telegram_message "$BUILD_ALIAS -- ./upload.sh failed! ❌" send_telegram_message "$BUILD_ALIAS -- ./upload.sh failed! ❌"
exit 1 exit 1
fi fi

View File

@ -6,7 +6,7 @@ trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")" cd "$(dirname "$0")"
if [[ ($1 == '--help') || ($1 == '-h') ]]; then if [[ ($1 == '--help') || ($1 == '-h') ]]; then
echo "usage: $(basename $0) [firefox|firefox-win64|webkit] [--check] [zip-path]" echo "usage: $(basename $0) [firefox-linux|firefox-win32|firefox-win64|webkit-gtk|webkit-win64|webkit-mac-10.14|webkit-mac-10.15] [--check] [zip-path]"
echo echo
echo "Upload .zip as a browser build." echo "Upload .zip as a browser build."
echo echo
@ -30,65 +30,42 @@ if [[ $# < 1 ]]; then
echo "try '$(basename $0) --help' for more information" echo "try '$(basename $0) --help' for more information"
exit 1 exit 1
fi fi
BROWSER_NAME=""
BUILD_NUMBER=""
BLOB_NAME=""
ALIAS=""
if [[ ("$1" == "firefox") || ("$1" == "firefox/") ]]; then BUILD_FLAVOR="$1"
BUILD_NUMBER=$(cat "$PWD/firefox/BUILD_NUMBER") BROWSER_NAME=""
BLOB_NAME=""
if [[ "$BUILD_FLAVOR" == "firefox-linux" ]]; then
BROWSER_NAME="firefox" BROWSER_NAME="firefox"
if [[ "$(uname)" == "Darwin" ]]; then BLOB_NAME="firefox-linux.zip"
BLOB_NAME="firefox-mac.zip" elif [[ "$BUILD_FLAVOR" == "firefox-mac" ]]; then
ALIAS="firefox-mac r$BUILD_NUMBER"
elif [[ "$(uname)" == "Linux" ]]; then
BLOB_NAME="firefox-linux.zip"
ALIAS="ff-linux r$BUILD_NUMBER"
elif [[ "$(uname)" == MINGW* ]]; then
BLOB_NAME="firefox-win32.zip"
ALIAS="ff-win32 r$BUILD_NUMBER"
else
echo "ERROR: unsupported platform - $(uname)"
exit 1
fi
elif [[ ("$1" == "firefox-win64") || ("$1" == "firefox-win64/") ]]; then
BUILD_NUMBER=$(cat "$PWD/firefox/BUILD_NUMBER")
BROWSER_NAME="firefox" BROWSER_NAME="firefox"
if [[ "$(uname)" == MINGW* ]]; then BLOB_NAME="firefox-mac.zip"
BLOB_NAME="firefox-win64.zip" elif [[ "$BUILD_FLAVOR" == "firefox-win32" ]]; then
ALIAS="ff-win64 r$BUILD_NUMBER" BROWSER_NAME="firefox"
else BLOB_NAME="firefox-win32.zip"
echo "ERROR: unsupported platform for browser '$1' - $(uname)" elif [[ "$BUILD_FLAVOR" == "firefox-win64" ]]; then
exit 1 BROWSER_NAME="firefox"
fi BLOB_NAME="firefox-win64.zip"
elif [[ ("$1" == "webkit") || ("$1" == "webkit/") ]]; then elif [[ "$BUILD_FLAVOR" == "webkit-gtk" ]]; then
BUILD_NUMBER=$(cat "$PWD/webkit/BUILD_NUMBER")
BROWSER_NAME="webkit" BROWSER_NAME="webkit"
if [[ "$(uname)" == "Darwin" ]]; then BLOB_NAME="minibrowser-gtk.zip"
MAC_MAJOR_MINOR_VERSION=$(sw_vers -productVersion | grep -o '^\d\+.\d\+') elif [[ "$BUILD_FLAVOR" == "webkit-win64" ]]; then
BLOB_NAME="minibrowser-mac-$MAC_MAJOR_MINOR_VERSION.zip" BROWSER_NAME="webkit"
ALIAS="webkit-mac-$MAC_MAJOR_MINOR_VERSION r$BUILD_NUMBER" BLOB_NAME="minibrowser-win64.zip"
elif [[ "$(uname)" == "Linux" ]]; then elif [[ "$BUILD_FLAVOR" == "webkit-mac-10.14" ]]; then
BLOB_NAME="minibrowser-gtk.zip" BROWSER_NAME="webkit"
ALIAS="webkit-gtk r$BUILD_NUMBER" BLOB_NAME="minibrowser-mac-10.14.zip"
elif [[ "$(uname)" == MINGW* ]]; then elif [[ "$BUILD_FLAVOR" == "webkit-mac-10.15" ]]; then
BLOB_NAME="minibrowser-win64.zip" BROWSER_NAME="webkit"
ALIAS="webkit-win64 r$BUILD_NUMBER" BLOB_NAME="minibrowser-mac-10.15.zip"
else
echo "ERROR: unsupported platform - $(uname)"
exit 1
fi
else else
echo ERROR: unknown browser to export - "$1" echo ERROR: unknown build flavor - "$BUILD_FLAVOR"
exit 1 exit 1
fi fi
if [[ ("$2" == '--show-alias') || ("$3" == '--show-alias') ]]; then BUILD_NUMBER=$(cat ./$BROWSER_NAME/BUILD_NUMBER)
echo $ALIAS
exit 0
fi
BLOB_PATH="$BROWSER_NAME/$BUILD_NUMBER/$BLOB_NAME" BLOB_PATH="$BROWSER_NAME/$BUILD_NUMBER/$BLOB_NAME"
if [[ ("$2" == '--check') || ("$3" == '--check') ]]; then if [[ ("$2" == '--check') || ("$3" == '--check') ]]; then
EXISTS=$(az storage blob exists -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -n "$BLOB_PATH" --query "exists") EXISTS=$(az storage blob exists -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -n "$BLOB_PATH" --query "exists")
if [[ $EXISTS == "true" ]]; then if [[ $EXISTS == "true" ]]; then
@ -103,7 +80,9 @@ if [[ $# < 2 ]]; then
echo "try '$(basename $0) --help' for more information" echo "try '$(basename $0) --help' for more information"
exit 1 exit 1
fi fi
ZIP_PATH=$2
ZIP_PATH="$2"
if ! [[ -f $ZIP_PATH ]]; then if ! [[ -f $ZIP_PATH ]]; then
echo "ERROR: $ZIP_PATH does not exist" echo "ERROR: $ZIP_PATH does not exist"
exit 1 exit 1