-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.staging.yaml
More file actions
75 lines (67 loc) · 1.83 KB
/
Copy pathcloudbuild.staging.yaml
File metadata and controls
75 lines (67 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Cloud Build configuration for staging deployments (non-main branches)
steps:
# Install dependencies
- name: 'node'
entrypoint: 'npm'
args:
- 'ci'
# Build Docker image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/l0013-staging:$COMMIT_SHA'
- '-t'
- 'gcr.io/$PROJECT_ID/l0013-staging:$BRANCH_NAME'
- '.'
# Push image to Container Registry
- name: gcr.io/cloud-builders/docker
args:
- push
- '--all-tags'
- 'gcr.io/$PROJECT_ID/l0013-staging'
id: Push
# Deploy to Cloud Run (staging service)
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim'
args:
- run
- deploy
- 'l0013-$BRANCH_NAME'
- '--platform=managed'
- '--image=gcr.io/$PROJECT_ID/l0013-staging:$COMMIT_SHA'
- >-
--labels=commit-sha=$COMMIT_SHA,gcb-build-id=$BUILD_ID,gcb-trigger-id=$_TRIGGER_ID,branch=$BRANCH_NAME
- '--region=$_DEPLOY_REGION'
- '--quiet'
- '--port=50013'
- '--set-env-vars=AUTH_URL=$_AUTH_URL,NODE_ENV=staging,BRANCH=$BRANCH_NAME'
- '--allow-unauthenticated'
- '--max-instances=10'
- '--memory=256Mi'
id: Deploy
entrypoint: gcloud
# Output the service URL
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim'
args:
- run
- services
- describe
- 'l0013-$BRANCH_NAME'
- '--platform=managed'
- '--region=$_DEPLOY_REGION'
- '--format=value(status.url)'
id: Get URL
entrypoint: gcloud
images:
- 'gcr.io/$PROJECT_ID/l0013-staging:$COMMIT_SHA'
- 'gcr.io/$PROJECT_ID/l0013-staging:$BRANCH_NAME'
options:
substitutionOption: ALLOW_LOOSE
logging: CLOUD_LOGGING_ONLY
substitutions:
_DEPLOY_REGION: us-central1
_AUTH_URL: https://auth.graffiticode.org
tags:
- l0013
- staging
- $BRANCH_NAME