Skip to content

Commit 8db269c

Browse files
committed
Add update-traffic
1 parent 1da63e0 commit 8db269c

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help prepare doc test serve build publish-production
1+
.PHONY: help prepare doc test serve build publish-production deploy-production promote-production production
22
.DEFAULT_GOAL := help
33
SHELL:=/bin/bash
44

@@ -56,7 +56,7 @@ serve-oauth: ## Serve Panel dashboard - Prod mode with OAuth2. Needs: PANEL_OAU
5656
# Deployment commands
5757
# --progress=plain
5858

59-
build-local:
59+
build-local: ## Build for local architecture
6060
docker build -f ./panel/Dockerfile \
6161
--tag simdec-panel-local:$(version) \
6262
--pull \
@@ -77,7 +77,7 @@ run-local: build-local
7777
simdec-panel-local:$(version)
7878

7979
# Need to specifically build on linux/amd64 to avoid issues on macOS M platform
80-
build:
80+
build: ## Build for linux/amd64 (production)
8181
docker build -f ./panel/Dockerfile \
8282
--platform linux/amd64 \
8383
--tag simdec-panel:$(version) \
@@ -100,11 +100,12 @@ run: build
100100

101101
# Ship
102102

103-
publish-production: build
103+
publish-production: build ## Tag and push to GCP
104104
docker tag simdec-panel:$(version) $(region)-docker.pkg.dev/$(project)/simdec-panel/simdec-panel:$(version)
105105
docker push $(region)-docker.pkg.dev/$(project)/simdec-panel/simdec-panel:$(version)
106106

107-
production: publish-production
107+
108+
deploy-production: publish-production ## Deploy new revision to GCP
108109
@echo "Deploying '$(version)'."
109110
gcloud run deploy simdec-panel \
110111
--cpu=2 \
@@ -124,4 +125,8 @@ production: publish-production
124125
--timeout=60m \
125126
--service-account simdec-panel@delta-entity-401706.iam.gserviceaccount.com \
126127
--image=$(region)-docker.pkg.dev/$(project)/simdec-panel/simdec-panel:$(version) \
127-
--memory 2Gi
128+
--memory 2Gi \
129+
--no-traffic
130+
131+
promote-production: ## Serve new revision to GCP
132+
gcloud run services update-traffic simdec-panel --to-latest

panel/cloudbuild.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ steps:
4949
- '--region=$_DEPLOY_REGION'
5050
id: Deploy
5151
entrypoint: gcloud
52+
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim'
53+
args:
54+
- run
55+
- services
56+
- update-traffic
57+
- '--to-revisions=LATEST=100'
58+
id: Serve
59+
entrypoint: gcloud
5260
images:
5361
- >-
5462
$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA

0 commit comments

Comments
 (0)