From 639d70e10c645c25ee82b33d5c20ef276e476884 Mon Sep 17 00:00:00 2001 From: DanielRyanSmith Date: Thu, 13 Feb 2025 07:18:24 +0000 Subject: [PATCH 1/2] Add quiet flag for production deployment --- Makefile | 2 +- util/deploy-production.sh | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 4687bf54da..6397139652 100644 --- a/Makefile +++ b/Makefile @@ -300,7 +300,7 @@ cleanup_staging_versions: gcloud_login deploy_production: deployment_state gcloud config set project wptdashboard - util/deploy.sh -r $(APP_PATH) + util/deploy.sh -r $(APP_PATH) ${QUIET:+-q} rm -rf $(WPTD_PATH)api/query/cache/service/wpt.fyi rm -rf $(WPTD_PATH)webapp/web/wpt.fyi diff --git a/util/deploy-production.sh b/util/deploy-production.sh index 9af4d66c5b..4e11673f46 100755 --- a/util/deploy-production.sh +++ b/util/deploy-production.sh @@ -7,9 +7,10 @@ set -e usage() { - USAGE="Usage: deploy-production.sh [-f] [-b] + USAGE="Usage: deploy-production.sh [-f] [-b] [-q] -b : skip GitHub issue creation - -f : Always deploy (even if checks have failed)" + -f : Always deploy (even if checks have failed) + -q : Disable all interactive prompts when running gcloud deploy commands" echo "${USAGE}" } @@ -17,17 +18,14 @@ usage() { delete_oldest_version() { OLDEST_REV=$(gcloud app --project=wptdashboard versions list --sort-by=last_deployed_time --filter="service=$1" --limit=1 --format=json | jq -r '.[] | .id') echo "Deleting $1 service version $OLDEST_REV" - if confirm "Delete $1 service version $OLDEST_REV?"; then - gcloud app versions delete --service=$SERVICE $OLDEST_REV - else - echo "Skipping $1 service version $OLDEST_REV" - fi + gcloud app versions delete --service=$SERVICE $OLDEST_REV ${QUIET:+--quiet} } -while getopts ':bfh' flag; do +while getopts ':bfqh' flag; do case "${flag}" in b) SKIP_ISSUE_CREATION='true' ;; f) FORCE_DEPLOY='true' ;; + q) QUIET='true' ;; h|*) usage && exit 0;; esac done @@ -116,11 +114,11 @@ ${UTIL_DIR}/docker-dev/run.sh -d # Login to gcloud if not already logged in. wptd_exec_it gcloud auth login # Deploy the services. -wptd_exec_it make deploy_production PROJECT=wptdashboard APP_PATH=webapp/web -wptd_exec_it make deploy_production PROJECT=wptdashboard APP_PATH=results-processor -wptd_exec_it make deploy_production PROJECT=wptdashboard APP_PATH=api/query/cache/service +wptd_exec_it make deploy_production PROJECT=wptdashboard APP_PATH=webapp/web ${QUIET:+QUIET=true} +wptd_exec_it make deploy_production PROJECT=wptdashboard APP_PATH=results-processor ${QUIET:+QUIET=true} +wptd_exec_it make deploy_production PROJECT=wptdashboard APP_PATH=api/query/cache/service ${QUIET:+QUIET=true} cd webapp/web -gcloud app deploy --project=wptdashboard index.yaml queue.yaml dispatch.yaml +gcloud app deploy ${QUIET:+--quiet} --project=wptdashboard index.yaml queue.yaml dispatch.yaml cd ../.. # Stop docker. From e920e351ae42b5e46ce503d916a8eacff615a8c7 Mon Sep 17 00:00:00 2001 From: DanielRyanSmith Date: Thu, 13 Feb 2025 21:41:57 +0000 Subject: [PATCH 2/2] Changes suggested by @past --- Makefile | 2 +- util/deploy-production.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 6397139652..65e632e7c6 100644 --- a/Makefile +++ b/Makefile @@ -300,7 +300,7 @@ cleanup_staging_versions: gcloud_login deploy_production: deployment_state gcloud config set project wptdashboard - util/deploy.sh -r $(APP_PATH) ${QUIET:+-q} + util/deploy.sh -r ${QUIET:+-q} $(APP_PATH) rm -rf $(WPTD_PATH)api/query/cache/service/wpt.fyi rm -rf $(WPTD_PATH)webapp/web/wpt.fyi diff --git a/util/deploy-production.sh b/util/deploy-production.sh index 4e11673f46..98f0c8b00d 100755 --- a/util/deploy-production.sh +++ b/util/deploy-production.sh @@ -8,9 +8,9 @@ set -e usage() { USAGE="Usage: deploy-production.sh [-f] [-b] [-q] - -b : skip GitHub issue creation + -b : Skip GitHub issue creation -f : Always deploy (even if checks have failed) - -q : Disable all interactive prompts when running gcloud deploy commands" + -q : Disable all interactive prompts and debugging output when running gcloud deploy commands" echo "${USAGE}" } @@ -18,7 +18,7 @@ usage() { delete_oldest_version() { OLDEST_REV=$(gcloud app --project=wptdashboard versions list --sort-by=last_deployed_time --filter="service=$1" --limit=1 --format=json | jq -r '.[] | .id') echo "Deleting $1 service version $OLDEST_REV" - gcloud app versions delete --service=$SERVICE $OLDEST_REV ${QUIET:+--quiet} + gcloud app versions delete --service=$SERVICE ${QUIET:+--quiet} $OLDEST_REV } while getopts ':bfqh' flag; do