| # Copyright 2021 The Go Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style |
| # license that can be found in the LICENSE file. |
| # Deploy the vuln worker to Cloud Run. |
| source devtools/lib.sh || { echo "Are you at repo root?"; exit 1; } |
| # Report whether the current repo's workspace has no uncommitted files. |
| [[ $(git status --porcelain) == '' ]] |
| local timestamp=$(date +%Y%m%dt%H%M%S) |
| local commit=$(git rev-parse --short HEAD) |
| if ! clean_workspace; then |
| echo ${timestamp}-${commit}${unclean} |
| dev) project=go-discovery-exp;; |
| prod) project=golang-org;; |
| die "usage: $0 [-n] (dev | prod)" |
| local image=gcr.io/$project/vuln-worker:$(docker_image_tag) |
| $prefix docker build -t $image -f cmd/worker/Dockerfile . |
| $prefix docker push $image |
| $prefix gcloud run deploy --quiet --project $project $env-vuln-worker --image $image |
| # If there was a rollback, `gcloud run deploy` will create a revision but |
| # not point traffic to it. The following command ensures that the new revision |
| $prefix gcloud run services --project $project update-traffic $env-vuln-worker --to-latest |