Skip to content

Commit

Permalink
Add quiet flag to production deployment script (#4263)
Browse files Browse the repository at this point in the history
* Add quiet flag for production deployment

* Changes suggested by @past

---------

Co-authored-by: DanielRyanSmith <[email protected]>
  • Loading branch information
DanielRyanSmith and DanielRyanSmith authored Feb 13, 2025
1 parent f6f4b7e commit 38af5bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ${QUIET:+-q} $(APP_PATH)
rm -rf $(WPTD_PATH)api/query/cache/service/wpt.fyi
rm -rf $(WPTD_PATH)webapp/web/wpt.fyi

Expand Down
24 changes: 11 additions & 13 deletions util/deploy-production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,25 @@
set -e

usage() {
USAGE="Usage: deploy-production.sh [-f] [-b]
-b : skip GitHub issue creation
-f : Always deploy (even if checks have failed)"
USAGE="Usage: deploy-production.sh [-f] [-b] [-q]
-b : Skip GitHub issue creation
-f : Always deploy (even if checks have failed)
-q : Disable all interactive prompts and debugging output when running gcloud deploy commands"
echo "${USAGE}"
}

# Deletes the service passed as a parameter.
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 ${QUIET:+--quiet} $OLDEST_REV
}

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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 38af5bc

Please sign in to comment.