From 081156a20896d562a3f61e90405743916b5189fe Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 1 Dec 2021 22:50:42 -0500 Subject: [PATCH] website: publish all commits, eliminating Website-Publish+1 vote The main point of Website-Publish+1 was to manually avoid a race in Cloud Build when multiple commits land. But now cmd/locktrigger takes care of that race automatically, so there is little point to Website-Publish+1 now. Stop looking for it. (If a commit landed without Website-Publish+1, it would still be published with the next Website-Publish+1 commit, so it was no real restriction on who can publish content.) I considered adding a rule like "DO NOT PUBLISH" in a commit message means not to publish the commit, but once it lands, again the next publishable commit is going to publish all previous commits, so even the possibility of landing such commits puts the repo in a very fragile state. Better not to support that idea at all. Fixes golang/go#36707. Change-Id: Icfe3bcdb0003608ff84bb300c43b61b542236571 Reviewed-on: https://go-review.googlesource.com/c/website/+/368366 Trust: Russ Cox Run-TryBot: Russ Cox TryBot-Result: Gopher Robot Reviewed-by: Dmitri Shuralyov --- cmd/golangorg/README.md | 7 +++---- go-app-deploy.sh | 38 ++++++++++++++++---------------------- 2 files changed, 19 insertions(+), 26 deletions(-) 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 -