Skip to content

Commit 53be7f8

Browse files
committed
cmd/gitmirror: switch to cloud build
Change-Id: I357a047197e8415f892de8e920b72afe54ff6ad7 Reviewed-on: https://go-review.googlesource.com/c/build/+/637156 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Carlos Amedee <[email protected]>
1 parent 3a71ca2 commit 53be7f8

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

cmd/gitmirror/Makefile

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,14 @@
33
# license that can be found in the LICENSE file.
44

55
MUTABLE_VERSION ?= latest
6-
VERSION ?= $(shell git rev-parse --short HEAD)
6+
VERSION := $(shell ../coordinator/version.sh)
77

8-
IMAGE_STAGING := gcr.io/go-dashboard-dev/gitmirror
98
IMAGE_PROD := gcr.io/symbolic-datum-552/gitmirror
109

11-
docker-prod:
12-
docker build -f Dockerfile --force-rm --tag=$(IMAGE_PROD):$(VERSION) ../..
13-
docker tag $(IMAGE_PROD):$(VERSION) $(IMAGE_PROD):$(MUTABLE_VERSION)
14-
docker-staging:
15-
docker build -f Dockerfile --force-rm --tag=$(IMAGE_STAGING):$(VERSION) ../..
16-
docker tag $(IMAGE_STAGING):$(VERSION) $(IMAGE_STAGING):$(MUTABLE_VERSION)
17-
18-
push-prod: docker-prod
19-
docker push $(IMAGE_PROD):$(MUTABLE_VERSION)
20-
docker push $(IMAGE_PROD):$(VERSION)
21-
push-staging: docker-staging
22-
docker push $(IMAGE_STAGING):$(MUTABLE_VERSION)
23-
docker push $(IMAGE_STAGING):$(VERSION)
10+
push-prod:
11+
gcloud builds submit --project=symbolic-datum-552 --config=cloudbuild.yaml --substitutions=TAG_NAME="$(VERSION)" ../..
2412

2513
deploy-prod: push-prod
26-
kubectl set image --namespace=prod deployment/gitmirror-serving-deployment gitmirror=$(IMAGE_PROD):$(VERSION)
27-
kubectl set image --namespace=prod deployment/gitmirror-mirroring-deployment gitmirror=$(IMAGE_PROD):$(VERSION)
28-
29-
deploy-staging: push-staging
30-
echo "no staging configuration"
31-
exit 1
14+
go install golang.org/x/build/cmd/xb
15+
xb --prod kubectl --namespace prod set image deployment/gitmirror-serving-deployment gitmirror=$(IMAGE_PROD):$(VERSION)
16+
xb --prod kubectl --namespace prod set image deployment/gitmirror-mirroring-deployment gitmirror=$(IMAGE_PROD):$(VERSION)

cmd/gitmirror/cloudbuild.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2024 The Go Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style
3+
# license that can be found in the LICENSE file.
4+
5+
steps:
6+
- name: 'gcr.io/cloud-builders/docker'
7+
args:
8+
- 'build'
9+
- '-f'
10+
- 'cmd/gitmirror/Dockerfile'
11+
- '--build-arg'
12+
- 'version=${TAG_NAME}'
13+
- '-t'
14+
- 'gcr.io/symbolic-datum-552/gitmirror:${TAG_NAME}'
15+
- '-t'
16+
- 'gcr.io/symbolic-datum-552/gitmirror:latest'
17+
- '.'
18+
- name: 'gcr.io/cloud-builders/docker'
19+
args: ['push', 'gcr.io/symbolic-datum-552/gitmirror:${TAG_NAME}']
20+
images:
21+
- 'gcr.io/symbolic-datum-552/gitmirror:${TAG_NAME}'
22+
- 'gcr.io/symbolic-datum-552/gitmirror:latest'
23+
options:
24+
logging: CLOUD_LOGGING_ONLY

0 commit comments

Comments
 (0)