2017-07-28 06:57:44 -04:00
|
|
|
#!/usr/bin/env bash
|
2017-08-08 19:22:12 -04:00
|
|
|
set +x -eu -o pipefail
|
2017-07-28 06:57:44 -04:00
|
|
|
|
2018-10-18 07:49:30 -04:00
|
|
|
readonly deployToFirebaseDryRun="`dirname $0`/deploy-to-firebase.sh --dry-run"
|
|
|
|
|
2017-07-28 06:57:44 -04:00
|
|
|
function check {
|
|
|
|
if [[ $1 == $2 ]]; then
|
|
|
|
echo Pass
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
echo Fail
|
|
|
|
echo ---- Expected ----
|
|
|
|
echo "$2"
|
|
|
|
echo ---- Actual ----
|
|
|
|
echo "$1"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2018-10-18 07:49:30 -04:00
|
|
|
(
|
|
|
|
echo ===== master - skip deploy - not angular
|
|
|
|
actual=$(
|
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=notangular
|
|
|
|
$deployToFirebaseDryRun
|
|
|
|
)
|
|
|
|
expected="Skipping deploy because this is not angular/angular."
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
echo ===== master - skip deploy - angular fork
|
|
|
|
actual=$(
|
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=notangular
|
|
|
|
export CI_REPO_NAME=angular
|
|
|
|
$deployToFirebaseDryRun
|
|
|
|
)
|
|
|
|
expected="Skipping deploy because this is not angular/angular."
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
2017-07-28 06:57:44 -04:00
|
|
|
(
|
|
|
|
echo ===== master - skip deploy - pull request
|
|
|
|
actual=$(
|
2018-10-18 07:49:30 -04:00
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=angular
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_PULL_REQUEST=true
|
2018-10-18 07:49:30 -04:00
|
|
|
$deployToFirebaseDryRun
|
2017-07-28 06:57:44 -04:00
|
|
|
)
|
|
|
|
expected="Skipping deploy because this is a PR build."
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
echo ===== master - deploy success
|
|
|
|
actual=$(
|
2018-10-18 07:49:30 -04:00
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=angular
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_PULL_REQUEST=false
|
|
|
|
export CI_BRANCH=master
|
2018-10-18 07:49:30 -04:00
|
|
|
export CI_COMMIT=$(git ls-remote origin master | cut -c1-40)
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN=XXXXX
|
2018-10-18 07:49:30 -04:00
|
|
|
$deployToFirebaseDryRun
|
2017-07-28 06:57:44 -04:00
|
|
|
)
|
|
|
|
expected="Git branch : master
|
|
|
|
Build/deploy mode : next
|
|
|
|
Firebase project : aio-staging
|
2020-06-25 19:35:24 -04:00
|
|
|
Firebase site : aio-staging
|
2017-07-28 06:57:44 -04:00
|
|
|
Deployment URL : https://next.angular.io/"
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
echo ===== master - skip deploy - commit not HEAD
|
|
|
|
actual=$(
|
2018-10-18 07:49:30 -04:00
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=angular
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_PULL_REQUEST=false
|
|
|
|
export CI_BRANCH=master
|
|
|
|
export CI_COMMIT=DUMMY_TEST_COMMIT
|
2018-10-18 07:49:30 -04:00
|
|
|
$deployToFirebaseDryRun
|
2017-07-28 06:57:44 -04:00
|
|
|
)
|
|
|
|
expected="Skipping deploy because DUMMY_TEST_COMMIT is not the latest commit ($(git ls-remote origin master | cut -c1-40))."
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
echo ===== stable - deploy success
|
|
|
|
actual=$(
|
2018-10-18 07:49:30 -04:00
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=angular
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_PULL_REQUEST=false
|
|
|
|
export CI_BRANCH=4.3.x
|
2018-10-18 07:49:30 -04:00
|
|
|
export CI_STABLE_BRANCH=4.3.x
|
|
|
|
export CI_COMMIT=$(git ls-remote origin 4.3.x | cut -c1-40)
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN=XXXXX
|
2018-10-18 07:49:30 -04:00
|
|
|
$deployToFirebaseDryRun
|
2017-07-28 06:57:44 -04:00
|
|
|
)
|
|
|
|
expected="Git branch : 4.3.x
|
|
|
|
Build/deploy mode : stable
|
|
|
|
Firebase project : angular-io
|
2020-06-25 19:35:24 -04:00
|
|
|
Firebase site : angular-io
|
2017-07-28 06:57:44 -04:00
|
|
|
Deployment URL : https://angular.io/"
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
echo ===== stable - skip deploy - commit not HEAD
|
|
|
|
actual=$(
|
2018-10-18 07:49:30 -04:00
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=angular
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_PULL_REQUEST=false
|
|
|
|
export CI_BRANCH=4.3.x
|
2018-10-18 07:49:30 -04:00
|
|
|
export CI_STABLE_BRANCH=4.3.x
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_COMMIT=DUMMY_TEST_COMMIT
|
2018-10-18 07:49:30 -04:00
|
|
|
$deployToFirebaseDryRun
|
2017-07-28 06:57:44 -04:00
|
|
|
)
|
|
|
|
expected="Skipping deploy because DUMMY_TEST_COMMIT is not the latest commit ($(git ls-remote origin 4.3.x | cut -c1-40))."
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
echo ===== archive - deploy success
|
|
|
|
actual=$(
|
2018-10-18 07:49:30 -04:00
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=angular
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_PULL_REQUEST=false
|
|
|
|
export CI_BRANCH=2.4.x
|
2018-10-18 07:49:30 -04:00
|
|
|
export CI_STABLE_BRANCH=4.3.x
|
|
|
|
export CI_COMMIT=$(git ls-remote origin 2.4.x | cut -c1-40)
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN=XXXXX
|
2018-10-18 07:49:30 -04:00
|
|
|
$deployToFirebaseDryRun
|
2017-07-28 06:57:44 -04:00
|
|
|
)
|
|
|
|
expected="Git branch : 2.4.x
|
|
|
|
Build/deploy mode : archive
|
2018-05-04 18:08:17 -04:00
|
|
|
Firebase project : v2-angular-io
|
2020-06-25 19:35:24 -04:00
|
|
|
Firebase site : v2-angular-io
|
2017-07-28 06:57:44 -04:00
|
|
|
Deployment URL : https://v2.angular.io/"
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
2020-06-24 22:07:31 -04:00
|
|
|
(
|
|
|
|
echo ===== archive - v9-angular-io multisite special case - deploy success
|
|
|
|
actual=$(
|
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=angular
|
|
|
|
export CI_PULL_REQUEST=false
|
|
|
|
export CI_BRANCH=9.1.x
|
|
|
|
export CI_STABLE_BRANCH=10.0.x
|
|
|
|
export CI_COMMIT=$(git ls-remote origin 9.1.x | cut -c1-40)
|
|
|
|
export CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN=XXXXX
|
|
|
|
$deployToFirebaseDryRun
|
|
|
|
)
|
|
|
|
expected="Git branch : 9.1.x
|
|
|
|
Build/deploy mode : archive
|
2020-06-25 19:35:24 -04:00
|
|
|
Firebase project : aio-staging
|
|
|
|
Firebase site : v9-angular-io
|
2020-06-24 22:07:31 -04:00
|
|
|
Deployment URL : https://v9.angular.io/"
|
|
|
|
# TODO: This test incorrectly expects the Firebase project to be v9-angular-io.
|
|
|
|
# v9-angular-io is a "multisites" project currently within the aio-staging project
|
|
|
|
# This setup is temporary and was created in order to deploy v9.angular.io without
|
|
|
|
# disruptions.
|
|
|
|
# See https://angular-team.atlassian.net/browse/DEV-125 for more info.
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
2017-07-28 06:57:44 -04:00
|
|
|
(
|
|
|
|
echo ===== archive - skip deploy - commit not HEAD
|
|
|
|
actual=$(
|
2018-10-18 07:49:30 -04:00
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=angular
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_PULL_REQUEST=false
|
|
|
|
export CI_BRANCH=2.4.x
|
2018-10-18 07:49:30 -04:00
|
|
|
export CI_STABLE_BRANCH=4.3.x
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_COMMIT=DUMMY_TEST_COMMIT
|
|
|
|
export CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN=XXXXX
|
2018-10-18 07:49:30 -04:00
|
|
|
$deployToFirebaseDryRun
|
2017-07-28 06:57:44 -04:00
|
|
|
)
|
|
|
|
expected="Skipping deploy because DUMMY_TEST_COMMIT is not the latest commit ($(git ls-remote origin 2.4.x | cut -c1-40))."
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
echo ===== archive - skip deploy - major version too high, lower minor
|
|
|
|
actual=$(
|
2018-10-18 07:49:30 -04:00
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=angular
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_PULL_REQUEST=false
|
|
|
|
export CI_BRANCH=2.1.x
|
2018-10-18 07:49:30 -04:00
|
|
|
export CI_STABLE_BRANCH=2.2.x
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_COMMIT=$(git ls-remote origin 2.1.x | cut -c-40)
|
|
|
|
export CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN=XXXXX
|
2018-10-18 07:49:30 -04:00
|
|
|
$deployToFirebaseDryRun
|
2017-07-28 06:57:44 -04:00
|
|
|
)
|
|
|
|
expected="Skipping deploy of branch \"2.1.x\" to firebase.
|
|
|
|
We only deploy archive branches with the major version less than the stable branch: \"2.2.x\""
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
echo ===== archive - skip deploy - major version too high, higher minor
|
|
|
|
actual=$(
|
2018-10-18 07:49:30 -04:00
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=angular
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_PULL_REQUEST=false
|
|
|
|
export CI_BRANCH=2.4.x
|
2018-10-18 07:49:30 -04:00
|
|
|
export CI_STABLE_BRANCH=2.2.x
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_COMMIT=$(git ls-remote origin 2.4.x | cut -c-40)
|
|
|
|
export CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN=XXXXX
|
2018-10-18 07:49:30 -04:00
|
|
|
$deployToFirebaseDryRun
|
2017-07-28 06:57:44 -04:00
|
|
|
)
|
2017-08-08 19:22:12 -04:00
|
|
|
expected="Skipping deploy of branch \"2.4.x\" to firebase.
|
2017-07-28 06:57:44 -04:00
|
|
|
We only deploy archive branches with the major version less than the stable branch: \"2.2.x\""
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
echo ===== archive - skip deploy - minor version too low
|
|
|
|
actual=$(
|
2018-10-18 07:49:30 -04:00
|
|
|
export BASH_ENV=/dev/null
|
|
|
|
export CI_REPO_OWNER=angular
|
|
|
|
export CI_REPO_NAME=angular
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_PULL_REQUEST=false
|
|
|
|
export CI_BRANCH=2.1.x
|
2018-10-18 07:49:30 -04:00
|
|
|
export CI_STABLE_BRANCH=4.3.x
|
2018-10-17 12:19:15 -04:00
|
|
|
export CI_COMMIT=$(git ls-remote origin 2.1.x | cut -c-40)
|
|
|
|
export CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN=XXXXX
|
2018-10-18 07:49:30 -04:00
|
|
|
$deployToFirebaseDryRun
|
2017-07-28 06:57:44 -04:00
|
|
|
)
|
|
|
|
expected="Skipping deploy of branch \"2.1.x\" to firebase.
|
|
|
|
There is a more recent branch with the same major version: \"2.4.x\""
|
|
|
|
check "$actual" "$expected"
|
|
|
|
)
|