-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add quiet flag to production deployment script #4263
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,27 +7,25 @@ | |
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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: the quiet flag removes more things in deploy.sh, so I would rephrase it perhaps as "Disable all interactive prompts and debugging output". While you are here, do you mind making capitalization more uniform by changing "skip" to "Skip" in the line above? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
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 $OLDEST_REV ${QUIET:+--quiet} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A confirmation here is also removed because it is redundant with the confirmation that exists within the gcloud command, which made it required to confirm with 'y' twice There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: put the flags together before the version parameter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
} | ||
|
||
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} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't you need to similarly update the Makefile for this as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
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. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I'd reorder and put the flags together, before the app parameter.