-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
129 lines (122 loc) · 2.78 KB
/
cloudbuild.yaml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
steps:
# Build the EV Finder API container image
- name: "gcr.io/cloud-builders/docker"
args:
[
"build",
"-t",
"us-central1-docker.pkg.dev/${PROJECT_ID}/evfinder-api/evfinder-api:${TAG_NAME}",
".",
]
# Push to Artifact Registry
- name: "gcr.io/cloud-builders/docker"
args:
[
"push",
"us-central1-docker.pkg.dev/${PROJECT_ID}/evfinder-api/evfinder-api:${TAG_NAME}",
]
id: "docker push"
# Build and Deploy the API to Cloud Run
- name: google/cloud-sdk
args:
[
"gcloud",
"run",
"deploy",
"api",
"--image",
"us-central1-docker.pkg.dev/${PROJECT_ID}/evfinder-api/evfinder-api:${TAG_NAME}",
"--set-env-vars",
"VERSION=${TAG_NAME}",
"--set-env-vars",
"WEB_CONCURRENCY=2",
"--region",
"us-central1",
"--platform",
"managed",
"--execution-environment",
"gen1",
"--cpu-boost",
"--memory",
"512Mi",
"--no-use-http2",
"--concurrency",
"8",
"--allow-unauthenticated",
"--tag",
"latest",
"--no-traffic",
]
id: "deploy main api"
waitFor:
- "docker push"
# Build and deploy the Ford API
- name: google/cloud-sdk
args:
[
"gcloud",
"run",
"deploy",
"ford-api",
"--image",
"us-central1-docker.pkg.dev/${PROJECT_ID}/evfinder-api/evfinder-api:${TAG_NAME}",
"--set-env-vars",
"VERSION=${TAG_NAME}",
"--set-env-vars",
"WEB_CONCURRENCY=2",
"--region",
"us-central1",
"--platform",
"managed",
"--execution-environment",
"gen1",
"--cpu-boost",
"--memory",
"512Mi",
"--no-use-http2",
"--concurrency",
"8",
"--allow-unauthenticated",
"--tag",
"latest",
"--no-traffic",
]
id: "deploy ford api"
waitFor:
- "docker push"
# Swing traffic over to the newly deploy API
- name: google/cloud-sdk
args:
[
"gcloud",
"run",
"services",
"update-traffic",
"api",
"--to-tags",
"latest=100",
"--region",
"us-central1",
]
waitFor:
- "deploy main api"
# Swing traffic over to the newly deploy Ford API
- name: google/cloud-sdk
args:
[
"gcloud",
"run",
"services",
"update-traffic",
"ford-api",
"--to-tags",
"latest=100",
"--region",
"us-central1",
]
waitFor:
- "deploy ford api"
images:
- "us-central1-docker.pkg.dev/evfinder/evfinder-api/evfinder-api:${TAG_NAME}"
options:
logging: CLOUD_LOGGING_ONLY