diff --git a/cmd/coordinator/Makefile b/cmd/coordinator/Makefile
index bc80a17..74f749b 100644
--- a/cmd/coordinator/Makefile
+++ b/cmd/coordinator/Makefile
@@ -25,7 +25,8 @@
docker tag $(DOCKER_IMAGE):$(VERSION) $(IMAGE_STAGING):$(MUTABLE_VERSION)
push-prod:
- gcloud builds submit --project $(GCP_PROJECT_PROD) --config ./cloudbuild.yaml --substitutions=TAG_NAME="$(VERSION)" ../../
+ gcloud builds submit --project=$(GCP_PROJECT_PROD) --config=../../deploy/cloudbuild-from-local.yaml \
+ --substitutions="_SERVICE_NAME=coordinator,TAG_NAME=$(VERSION)" ../..
push-staging: docker-staging
docker push $(IMAGE_STAGING):$(VERSION)
diff --git a/cmd/coordinator/cloudbuild.yaml b/cmd/coordinator/cloudbuild.yaml
deleted file mode 100644
index 0be94b4..0000000
--- a/cmd/coordinator/cloudbuild.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 2023 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.
-
-steps:
-- name: 'gcr.io/cloud-builders/docker'
- args:
- - 'build'
- - '-f'
- - 'cmd/coordinator/Dockerfile'
- - '--build-arg'
- - 'version=${TAG_NAME}'
- - '-t'
- - 'gcr.io/symbolic-datum-552/coordinator:${TAG_NAME}'
- - '-t'
- - 'gcr.io/symbolic-datum-552/coordinator:latest'
- - '.'
-- name: 'gcr.io/cloud-builders/docker'
- args: ['push', 'gcr.io/symbolic-datum-552/coordinator:${TAG_NAME}']
-images:
-- 'gcr.io/symbolic-datum-552/coordinator:${TAG_NAME}'
-- 'gcr.io/symbolic-datum-552/coordinator:latest'
-options:
- logging: CLOUD_LOGGING_ONLY
diff --git a/cmd/gerritbot/Makefile b/cmd/gerritbot/Makefile
index 4c9cb0e..5f5b711 100644
--- a/cmd/gerritbot/Makefile
+++ b/cmd/gerritbot/Makefile
@@ -5,8 +5,9 @@
MUTABLE_VERSION ?= latest
VERSION ?= $(shell git rev-parse --short HEAD)
+GCP_PROJECT_PROD := symbolic-datum-552
IMAGE_STAGING := gcr.io/go-dashboard-dev/gerritbot
-IMAGE_PROD := gcr.io/symbolic-datum-552/gerritbot
+IMAGE_PROD := gcr.io/$(GCP_PROJECT_PROD)/gerritbot
docker-prod: Dockerfile
docker build --force-rm -f Dockerfile --tag=$(IMAGE_PROD):$(VERSION) ../..
@@ -15,9 +16,9 @@
docker build --force-rm -f Dockerfile --tag=$(IMAGE_STAGING):$(VERSION) ../..
docker tag $(IMAGE_STAGING):$(VERSION) $(IMAGE_STAGING):$(MUTABLE_VERSION)
-push-prod: docker-prod
- docker push $(IMAGE_PROD):$(VERSION)
- docker push $(IMAGE_PROD):$(MUTABLE_VERSION)
+push-prod:
+ gcloud builds submit --project=$(GCP_PROJECT_PROD) --config=../../deploy/cloudbuild-from-local.yaml \
+ --substitutions="_SERVICE_NAME=gerritbot,TAG_NAME=$(VERSION)" ../..
push-staging: docker-staging
docker push $(IMAGE_STAGING):$(VERSION)
docker push $(IMAGE_STAGING):$(MUTABLE_VERSION)
diff --git a/cmd/gitmirror/Makefile b/cmd/gitmirror/Makefile
index 5f02502..72c6e76 100644
--- a/cmd/gitmirror/Makefile
+++ b/cmd/gitmirror/Makefile
@@ -5,10 +5,12 @@
MUTABLE_VERSION ?= latest
VERSION := $(shell ../coordinator/version.sh)
-IMAGE_PROD := gcr.io/symbolic-datum-552/gitmirror
+GCP_PROJECT_PROD := symbolic-datum-552
+IMAGE_PROD := gcr.io/$(GCP_PROJECT_PROD)/gitmirror
push-prod:
- gcloud builds submit --project=symbolic-datum-552 --config=cloudbuild.yaml --substitutions=TAG_NAME="$(VERSION)" ../..
+ gcloud builds submit --project=$(GCP_PROJECT_PROD) --config=../../deploy/cloudbuild-from-local.yaml \
+ --substitutions="_SERVICE_NAME=gitmirror,TAG_NAME=$(VERSION)" ../..
deploy-prod: push-prod
go install golang.org/x/build/cmd/xb
diff --git a/cmd/gitmirror/cloudbuild.yaml b/cmd/gitmirror/cloudbuild.yaml
deleted file mode 100644
index 7535b38..0000000
--- a/cmd/gitmirror/cloudbuild.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 2024 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.
-
-steps:
-- name: 'gcr.io/cloud-builders/docker'
- args:
- - 'build'
- - '-f'
- - 'cmd/gitmirror/Dockerfile'
- - '--build-arg'
- - 'version=${TAG_NAME}'
- - '-t'
- - 'gcr.io/symbolic-datum-552/gitmirror:${TAG_NAME}'
- - '-t'
- - 'gcr.io/symbolic-datum-552/gitmirror:latest'
- - '.'
-- name: 'gcr.io/cloud-builders/docker'
- args: ['push', 'gcr.io/symbolic-datum-552/gitmirror:${TAG_NAME}']
-images:
-- 'gcr.io/symbolic-datum-552/gitmirror:${TAG_NAME}'
-- 'gcr.io/symbolic-datum-552/gitmirror:latest'
-options:
- logging: CLOUD_LOGGING_ONLY
diff --git a/cmd/gomoteserver/Makefile b/cmd/gomoteserver/Makefile
index feee6f4..2f1922f 100644
--- a/cmd/gomoteserver/Makefile
+++ b/cmd/gomoteserver/Makefile
@@ -22,7 +22,8 @@
# push-prod builds and pushes the gomoteserver image using the local source code.
# The image is tagged with a version generated from the current git state.
push-prod:
- gcloud builds submit --project $(GCP_PROJECT_PROD) --config ./cloudbuild.yaml --substitutions=TAG_NAME="$(VERSION)" ../../
+ gcloud builds submit --project=$(GCP_PROJECT_PROD) --config=../../deploy/cloudbuild-from-local.yaml \
+ --substitutions="_SERVICE_NAME=gomoteserver,TAG_NAME=$(VERSION)" ../..
# deploy-prod deploys the version of the gomoteserver that was just pushed by the push-prod target.
deploy-prod: push-prod
@@ -38,7 +39,8 @@
ifndef SHA
$(error SHA is not set. Please provide a commit SHA. Usage: make push-prod-version SHA=<commit-sha>)
endif
- gcloud builds submit --project $(GCP_PROJECT_PROD) --config ./cloudbuild-version.yaml --substitutions=_SHA=$(SHA) --no-source
+ gcloud builds submit --project=$(GCP_PROJECT_PROD) --config=../../deploy/cloudbuild-from-googlesource.yaml \
+ --substitutions="_SERVICE_NAME=gomoteserver,_SHA=$(SHA)" --no-source
# deploy-prod-version deploys a specific version of the gomoteserver based on a git commit SHA.
# It first builds and pushes the image using the push-prod-version target, then deploys it.
diff --git a/cmd/gomoteserver/cloudbuild.yaml b/cmd/gomoteserver/cloudbuild.yaml
deleted file mode 100644
index 962e0d5..0000000
--- a/cmd/gomoteserver/cloudbuild.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 2023 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.
-
-steps:
-- name: 'gcr.io/cloud-builders/docker'
- args:
- - 'build'
- - '-f'
- - 'cmd/gomoteserver/Dockerfile'
- - '--build-arg'
- - 'version=${TAG_NAME}'
- - '-t'
- - 'gcr.io/symbolic-datum-552/gomoteserver:${TAG_NAME}'
- - '-t'
- - 'gcr.io/symbolic-datum-552/gomoteserver:latest'
- - '.'
-- name: 'gcr.io/cloud-builders/docker'
- args: ['push', 'gcr.io/symbolic-datum-552/gomoteserver:${TAG_NAME}']
-images:
-- 'gcr.io/symbolic-datum-552/gomoteserver:${TAG_NAME}'
-- 'gcr.io/symbolic-datum-552/gomoteserver:latest'
-options:
- logging: CLOUD_LOGGING_ONLY
diff --git a/cmd/gopherbot/Makefile b/cmd/gopherbot/Makefile
index 452d5bc..2a2b61f 100644
--- a/cmd/gopherbot/Makefile
+++ b/cmd/gopherbot/Makefile
@@ -5,8 +5,9 @@
MUTABLE_VERSION ?= latest
VERSION ?= $(shell git rev-parse --short HEAD)
+GCP_PROJECT_PROD := symbolic-datum-552
IMAGE_STAGING := gcr.io/go-dashboard-dev/gopherbot
-IMAGE_PROD := gcr.io/symbolic-datum-552/gopherbot
+IMAGE_PROD := gcr.io/$(GCP_PROJECT_PROD)/gopherbot
docker-image: Dockerfile *.go
docker build --force-rm -f Dockerfile --tag=$(IMAGE_PROD):$(VERSION) ../..
@@ -14,9 +15,9 @@
docker tag $(IMAGE_PROD):$(VERSION) $(IMAGE_STAGING):$(VERSION)
docker tag $(IMAGE_PROD):$(VERSION) $(IMAGE_STAGING):$(MUTABLE_VERSION)
-push-prod: docker-image
- docker push $(IMAGE_PROD):$(MUTABLE_VERSION)
- docker push $(IMAGE_PROD):$(VERSION)
+push-prod:
+ gcloud builds submit --project=$(GCP_PROJECT_PROD) --config=../../deploy/cloudbuild-from-local.yaml \
+ --substitutions="_SERVICE_NAME=gopherbot,TAG_NAME=$(VERSION)" ../..
push-staging: docker-image
docker push $(IMAGE_STAGING):$(MUTABLE_VERSION)
docker push $(IMAGE_STAGING):$(VERSION)
diff --git a/cmd/makemac/Makefile b/cmd/makemac/Makefile
index 711401c..cb93605 100644
--- a/cmd/makemac/Makefile
+++ b/cmd/makemac/Makefile
@@ -5,15 +5,16 @@
MUTABLE_VERSION ?= latest
VERSION ?= $(shell git rev-parse --short HEAD)
-IMAGE_PROD := gcr.io/symbolic-datum-552/makemac
+GCP_PROJECT_PROD := symbolic-datum-552
+IMAGE_PROD := gcr.io/$(GCP_PROJECT_PROD)/makemac
docker-prod:
docker build -f Dockerfile --force-rm --tag=$(IMAGE_PROD):$(VERSION) ../..
docker tag $(IMAGE_PROD):$(VERSION) $(IMAGE_PROD):$(MUTABLE_VERSION)
-push-prod: docker-prod
- docker push $(IMAGE_PROD):$(MUTABLE_VERSION)
- docker push $(IMAGE_PROD):$(VERSION)
+push-prod:
+ gcloud builds submit --project=$(GCP_PROJECT_PROD) --config=../../deploy/cloudbuild-from-local.yaml \
+ --substitutions="_SERVICE_NAME=makemac,TAG_NAME=$(VERSION)" ../..
deploy-prod: push-prod
go install golang.org/x/build/cmd/xb
diff --git a/cmd/pubsubhelper/Makefile b/cmd/pubsubhelper/Makefile
index 588a132..f268d77 100644
--- a/cmd/pubsubhelper/Makefile
+++ b/cmd/pubsubhelper/Makefile
@@ -5,8 +5,9 @@
MUTABLE_VERSION ?= latest
VERSION ?= $(shell git rev-parse --short HEAD)
+GCP_PROJECT_PROD := symbolic-datum-552
IMAGE_STAGING := gcr.io/go-dashboard-dev/pubsubhelper
-IMAGE_PROD := gcr.io/symbolic-datum-552/pubsubhelper
+IMAGE_PROD := gcr.io/$(GCP_PROJECT_PROD)/pubsubhelper
docker-prod:
docker build -f Dockerfile --force-rm --tag=$(IMAGE_PROD):$(VERSION) ../..
@@ -15,9 +16,9 @@
docker build -f Dockerfile --force-rm --tag=$(IMAGE_STAGING):$(VERSION) ../..
docker tag $(IMAGE_STAGING):$(VERSION) $(IMAGE_STAGING):$(MUTABLE_VERSION)
-push-prod: docker-prod
- docker push $(IMAGE_PROD):$(MUTABLE_VERSION)
- docker push $(IMAGE_PROD):$(VERSION)
+push-prod:
+ gcloud builds submit --project=$(GCP_PROJECT_PROD) --config=../../deploy/cloudbuild-from-local.yaml \
+ --substitutions="_SERVICE_NAME=pubsubhelper,TAG_NAME=$(VERSION)" ../..
push-staging: docker-staging
docker push $(IMAGE_STAGING):$(MUTABLE_VERSION)
docker push $(IMAGE_STAGING):$(VERSION)
diff --git a/cmd/relui/Makefile b/cmd/relui/Makefile
index 61b56f0..74886a3 100644
--- a/cmd/relui/Makefile
+++ b/cmd/relui/Makefile
@@ -42,8 +42,9 @@
test: postgres-dev docker-test
docker run --rm --name=relui-test -v $(POSTGRES_RUN_DEV) -e PGUSER=$(POSTGRES_USER) -e PGDATABASE=relui-test golang/relui-test:$(VERSION)
+GCP_PROJECT_PROD := symbolic-datum-552
DOCKER_IMAGE := golang/relui
-IMAGE_PROD := gcr.io/symbolic-datum-552/relui
+IMAGE_PROD := gcr.io/$(GCP_PROJECT_PROD)/relui
MUTABLE_VERSION := latest
.PHONY: docker
@@ -60,9 +61,9 @@
docker tag $(DOCKER_IMAGE):$(VERSION) $(IMAGE_PROD):$(MUTABLE_VERSION)
.PHONY: push-prod
-push-prod: docker-prod
- docker push $(IMAGE_PROD):$(VERSION)
- docker push $(IMAGE_PROD):$(MUTABLE_VERSION)
+push-prod:
+ gcloud builds submit --project=$(GCP_PROJECT_PROD) --config=../../deploy/cloudbuild-from-local.yaml \
+ --substitutions="_SERVICE_NAME=relui,TAG_NAME=$(VERSION)" ../..
.PHONY: deploy-prod
deploy-prod: push-prod
diff --git a/cmd/relui/cloudbuild.yaml b/cmd/relui/cloudbuild-test.yaml
similarity index 100%
rename from cmd/relui/cloudbuild.yaml
rename to cmd/relui/cloudbuild-test.yaml
diff --git a/cmd/watchflakes/Makefile b/cmd/watchflakes/Makefile
index 5682cdf..7bda1da 100644
--- a/cmd/watchflakes/Makefile
+++ b/cmd/watchflakes/Makefile
@@ -5,10 +5,12 @@
MUTABLE_VERSION ?= latest
VERSION := $(shell ../coordinator/version.sh)
-IMAGE_PROD := gcr.io/symbolic-datum-552/watchflakes
+GCP_PROJECT_PROD := symbolic-datum-552
+IMAGE_PROD := gcr.io/$(GCP_PROJECT_PROD)/watchflakes
push-prod:
- gcloud builds submit --project=symbolic-datum-552 --config=cloudbuild.yaml --substitutions=TAG_NAME="$(VERSION)" ../..
+ gcloud builds submit --project=$(GCP_PROJECT_PROD) --config=../../deploy/cloudbuild-from-local.yaml \
+ --substitutions="_SERVICE_NAME=watchflakes,TAG_NAME=$(VERSION)" ../..
deploy-prod: push-prod
go install golang.org/x/build/cmd/xb
diff --git a/cmd/watchflakes/cloudbuild.yaml b/cmd/watchflakes/cloudbuild.yaml
deleted file mode 100644
index c4bb478..0000000
--- a/cmd/watchflakes/cloudbuild.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 2024 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.
-
-steps:
-- name: 'gcr.io/cloud-builders/docker'
- args:
- - 'build'
- - '-f'
- - 'cmd/watchflakes/Dockerfile'
- - '--build-arg'
- - 'version=${TAG_NAME}'
- - '-t'
- - 'gcr.io/symbolic-datum-552/watchflakes:${TAG_NAME}'
- - '-t'
- - 'gcr.io/symbolic-datum-552/watchflakes:latest'
- - '.'
-- name: 'gcr.io/cloud-builders/docker'
- args: ['push', 'gcr.io/symbolic-datum-552/watchflakes:${TAG_NAME}']
-images:
-- 'gcr.io/symbolic-datum-552/watchflakes:${TAG_NAME}'
-- 'gcr.io/symbolic-datum-552/watchflakes:latest'
-options:
- logging: CLOUD_LOGGING_ONLY
diff --git a/cmd/gomoteserver/cloudbuild-version.yaml b/deploy/cloudbuild-from-googlesource.yaml
similarity index 68%
rename from cmd/gomoteserver/cloudbuild-version.yaml
rename to deploy/cloudbuild-from-googlesource.yaml
index baae155..8d8fa1b 100644
--- a/cmd/gomoteserver/cloudbuild-version.yaml
+++ b/deploy/cloudbuild-from-googlesource.yaml
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
+# Build by cloning https://go.googlesource.com/build at the given ${_SHA} commit.
+
steps:
# First, clone the repository. The default directory is /workspace.
- name: 'gcr.io/cloud-builders/git'
@@ -15,19 +17,19 @@
args:
- 'build'
- '-f'
- - 'cmd/gomoteserver/Dockerfile'
+ - 'cmd/${_SERVICE_NAME}/Dockerfile'
- '--build-arg'
- 'version=${_SHA}'
- '-t'
- - 'gcr.io/symbolic-datum-552/gomoteserver:${_SHA}'
+ - 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:${_SHA}'
- '-t'
- - 'gcr.io/symbolic-datum-552/gomoteserver:latest'
+ - 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:latest'
- '.'
# Finally, push the version-specific image.
- name: 'gcr.io/cloud-builders/docker'
- args: ['push', 'gcr.io/symbolic-datum-552/gomoteserver:${_SHA}']
+ args: ['push', 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:${_SHA}']
images:
-- 'gcr.io/symbolic-datum-552/gomoteserver:${_SHA}'
-- 'gcr.io/symbolic-datum-552/gomoteserver:latest'
+- 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:${_SHA}'
+- 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:latest'
options:
logging: CLOUD_LOGGING_ONLY
diff --git a/deploy/cloudbuild-from-local.yaml b/deploy/cloudbuild-from-local.yaml
new file mode 100644
index 0000000..f495242
--- /dev/null
+++ b/deploy/cloudbuild-from-local.yaml
@@ -0,0 +1,26 @@
+# Copyright 2023 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.
+
+# Build from a local git checkout of https://go.googlesource.com/build.
+
+steps:
+- name: 'gcr.io/cloud-builders/docker'
+ args:
+ - 'build'
+ - '-f'
+ - 'cmd/${_SERVICE_NAME}/Dockerfile'
+ - '--build-arg'
+ - 'version=${TAG_NAME}'
+ - '-t'
+ - 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:${TAG_NAME}'
+ - '-t'
+ - 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:latest'
+ - '.'
+- name: 'gcr.io/cloud-builders/docker'
+ args: ['push', 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:${TAG_NAME}']
+images:
+- 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:${TAG_NAME}'
+- 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:latest'
+options:
+ logging: CLOUD_LOGGING_ONLY
diff --git a/doc/deployment-more.md b/doc/deployment-more.md
new file mode 100644
index 0000000..ab9dd6a
--- /dev/null
+++ b/doc/deployment-more.md
@@ -0,0 +1,22 @@
+# More deployment notes
+
+Services in x/build that are deployed to our GKE cluster all follow the same
+workflow. See deployment.md for the common path.
+
+This file holds more notes for less common paths.
+
+## Building services with local Docker
+
+### First-time setup
+
+Install the `docker` command.
+
+Verify that `docker run hello-world` works without `sudo`. (You may need to run
+`sudo adduser $USER docker`, then either log out and back in or run `newgrp
+docker`.)
+
+Then run:
+
+```sh
+$ gcloud auth configure-docker
+```
diff --git a/doc/deployment.md b/doc/deployment.md
index 6e79f75..13a2de1 100644
--- a/doc/deployment.md
+++ b/doc/deployment.md
@@ -7,19 +7,9 @@
### First-time setup
-Install the `docker`, `kubectl`, and `gcloud` utilities.
+Install the `kubectl`, and `gcloud` utilities.
-Verify that `docker run hello-world` works without `sudo`. (You may need to run
-`sudo adduser $USER docker`, then either log out and back in or run `newgrp
-docker`.)
-
-Then run:
-
-```sh
-$ gcloud auth configure-docker
-```
-
-Install the App Engine Go SDK: [instructions](https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu)
+Install the App Engine Go SDK. See [instructions](https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu).
### Prod