diff --git a/cmd/golangorg/README.md b/cmd/golangorg/README.md index 9672017a..6ecab933 100644 --- a/cmd/golangorg/README.md +++ b/cmd/golangorg/README.md @@ -27,10 +27,9 @@ on production resources. ## Deploying to go.dev and golang.org Each time a CL is reviewed and submitted, the site is automatically deployed to App Engine. -If the CL is submitted with a Website-Publish +1 vote, -the new deployment automatically becomes https://go.dev/. -Otherwise, the new deployment can be found in the -[App Engine versions list](https://console.cloud.google.com/appengine/versions?project=golang-org&serviceId=default) and verified and manually promoted. +If it passes its serving-readiness checks, it will be automatically promoted to handle traffic. +Whether it passes or not, the new deployment can be found in the +[App Engine versions list](https://console.cloud.google.com/appengine/versions?project=golang-org&serviceId=default). If the automatic deployment is not working, or to check on the status of a pending deployment, see the “website-redeploy-golang-org” trigger in the diff --git a/go-app-deploy.sh b/go-app-deploy.sh index f3da8d1e..4578c26b 100644 --- a/go-app-deploy.sh +++ b/go-app-deploy.sh @@ -12,8 +12,8 @@ # # It customizes the usual "gcloud app deploy" in two ways. # -# First, it sets --no-promote or --promote according to whether -# the commit had a Website-Publish vote. +# First, it deploys with --no-promote and only promotes after +# the deployed app has passed an in-prod readiness test. # # Second, it chooses an app version like 2021-06-02-204309-2c120970 # giving the date, time, and commit hash of the commit being deployed. @@ -21,7 +21,7 @@ # Cloud Build at once and would otherwise end up with timestamps in # arbitrary order depending on the order in which Cloud Build happened # to reach each's gcloud app deploy command. With our choice, the -# versions are ordered in git order. +# versions are ordered in git time order. set -e @@ -44,16 +44,6 @@ if [ $# != 0 ]; then exit 2 fi -promote=$( - git cat-file -p 'HEAD' | - awk ' - BEGIN { flag = "false" } - /^Reviewed-on:/ { flag = "false" } - /^Website-Publish:/ { flag = "true" } - END {print flag} - ' -) - version=$(git log -n1 --date='format:%Y-%m-%d-%H%M%S' --pretty='format:%cd-%h') service=$(awk '$1=="service:" {print $2}' $yaml) @@ -72,15 +62,20 @@ curl --version for i in 1 2 3 4 5; do if curl -s --fail --show-error "https://$host/_readycheck"; then echo '### site is up!' - if $promote; then - serving=$(gcloud app services describe --project=$project $service | grep ': 1.0') - if [ "$serving" '>' "$version" ]; then - echo "### serving version $serving is newer than our $version; not promoting" - exit 1 - fi - echo '### promoting' - gcloud -q --project=$project app services set-traffic $service --splits=$version=1 + + # We used to have to worry about go-app-deploy.sh running for + # other commits simultaneously, so we checked that we weren't + # going to stomp a newer version of the web site. + # The use of locktrigger in cloudbuild.yaml should make this impossible, + # but keep checking anyway. + serving=$(gcloud app services describe --project=$project $service | grep ': 1.0') + if [ "$serving" '>' "$version" ]; then + echo "### serving version $serving is newer than our $version; not promoting" + exit 1 fi + + echo '### promoting' + gcloud -q --project=$project app services set-traffic $service --splits=$version=1 exit 0 fi echo '### not healthy' @@ -89,4 +84,3 @@ done echo "### failed to become healthy; giving up" exit 1 -