forked from googleforgames/agones
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
329 lines (278 loc) · 7.61 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# Copyright 2017 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Google Cloud Builder CI configuration
#
steps:
#
# Print Docker version
#
- name: "gcr.io/cloud-builders/docker"
id: docker-version
args: ["--version"]
#
# Restore any caches
#
- name: gcr.io/$PROJECT_ID/restore_cache
id: htmltest-restore-cache
args:
- '--bucket=gs://$_CACHE_BUCKET'
- '--key=$_HTMLTEST_CACHE_KEY'
waitFor: ['-']
- name: gcr.io/$PROJECT_ID/restore_cache
id: cpp-sdk-build-restore-cache
args:
- '--bucket=gs://$_CACHE_BUCKET'
- '--key=$_CPP_SDK_BUILD_CACHE_KEY-$( checksum sdks/cpp/cmake/prerequisites.cmake )'
waitFor: ['-']
- name: gcr.io/$PROJECT_ID/restore_cache
id: cpp-sdk-conformance-restore-cache
args:
- '--bucket=gs://$_CACHE_BUCKET'
- '--key=$_CPP_SDK_CONFORMANCE_CACHE_KEY-$( checksum sdks/cpp/cmake/prerequisites.cmake )'
waitFor: ['-']
- name: gcr.io/$PROJECT_ID/restore_cache
id: rust-sdk-build-restore-cache
args:
- '--bucket=gs://$_CACHE_BUCKET'
- '--key=$_RUST_SDK_BUILD_CACHE_KEY-$( checksum test/sdk/rust/Cargo.toml )'
waitFor: ['-']
#
# Creates the initial make + docker build platform
#
- name: "ubuntu"
args: ["bash", "-c", "echo 'FROM gcr.io/cloud-builders/docker\nRUN apt-get install make\nENTRYPOINT [\"/usr/bin/make\"]' > Dockerfile.build"]
waitFor: ['-']
- name: "gcr.io/cloud-builders/docker"
id: build-make-docker
args: ['build', '-f', 'Dockerfile.build', '-t', 'make-docker', '.'] # we need docker and make to run everything.
#
# pull the main build image if it exists
#
- name: "make-docker"
id: pull-build-image
dir: "build"
args: ["pull-build-image"]
waitFor:
- build-make-docker
#
# pull the sdk base image, if it exists
#
- name: "make-docker"
id: pull-build-sdk-base-image
dir: "build"
args: ["pull-build-sdk-base-image"]
waitFor:
- build-make-docker
#
# Ensure that there is the sdk base image, so that both tests
# and build can use them
#
- name: "make-docker"
id: ensure-build-sdk-image-base
waitFor:
- pull-build-sdk-base-image
dir: "build"
args: ["ensure-build-sdk-image-base"]
#
# build the e2e test runner
#
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-f', 'Dockerfile', '-t', 'e2e-runner', '.']
dir: 'build/e2e-image'
id: build-e2e
waitFor: ['-']
#
# Runs the linter -- but also builds the build image, if not able to download
#
- name: "make-docker"
id: lint
waitFor:
- pull-build-image
dir: "build"
args: ["lint"] # pull the build image if it exists
#
# Push the build image, can run while we do other things.
#
- name: "make-docker"
waitFor:
- lint
dir: "build"
args: ["push-build-image"] # push the build image (which won't do anything if it's already there)
#
# Push the sdk base build image, which can also run while we do other things
#
- name: "make-docker"
waitFor:
- ensure-build-sdk-image-base
dir: "build"
args: ["push-build-sdk-base-image"]
#
# Build all the images and sdks, and push them up to the repository
#
- name: "make-docker"
id: build-images
waitFor:
- lint
dir: "build"
args: [ "-j", "4", "build-images"]
- name: "make-docker"
id: push-images
waitFor:
- build-images
dir: "build"
args: [ "-j", "4", "push"]
#
# Build all the SDKs
#
- name: "make-docker"
id: build-sdks
waitFor:
- lint
- cpp-sdk-build-restore-cache
- ensure-build-sdk-image-base
dir: "build"
args: [ "-j", "4", "--output-sync=target", "build-sdks"]
#
# Cache the cpp sdk build directory, to speed up subsequent builds (considerably)
#
- name: 'gcr.io/$PROJECT_ID/save_cache'
args:
- '--bucket=gs://$_CACHE_BUCKET'
- '--key=$_CPP_SDK_BUILD_CACHE_KEY-$( checksum sdks/cpp/cmake/prerequisites.cmake )'
- '--path=sdks/cpp/.build'
id: cpp-sdk-build-save-cache
waitFor:
- build-sdks
#
# Run the all the automated tests (except e2e) in parallel
#
- name: "make-docker"
id: tests
waitFor:
- lint
- ensure-build-sdk-image-base
- htmltest-restore-cache
- build-sdks
dir: "build"
args: [ "-j", "5", "--output-sync=target", "test" ]
#
# Cache the htmltest url checks. Faster builds, and lower network flakiness.
#
- name: 'gcr.io/$PROJECT_ID/save_cache'
args:
- '--bucket=gs://$_CACHE_BUCKET'
- '--key=$_HTMLTEST_CACHE_KEY'
- '--path=site/tmp'
id: htmltest-save-cache
waitFor:
- tests
#
# Site preview
#
# don't promote, as it can cause failures when two deploys try and promote at the same time.
- name: "make-docker" # build a preview of the website
id: site-static
waitFor:
- tests
dir: "build"
args: ["site-static-preview", "site-gen-app-yaml", "SERVICE=preview"]
- name: "gcr.io/cloud-builders/gcloud" # deploy the preview of the website
id: "deploy-site-static"
waitFor:
- site-static
dir: "site"
args: ["app", "deploy", ".app.yaml", "--no-promote", "--version=$SHORT_SHA"]
env:
- GOPATH=/workspace/go
- GO111MODULE=on
#
# Run the e2e tests with FeatureGates inverted compared to Stable
#
- name: 'e2e-runner'
args: ['PlayerTracking=true&NodeExternalDNS=false&StateAllocationFilter=true&PlayerAllocationFilter=true&CustomFasSyncInterval=true', 'e2e-test-cluster']
id: e2e-feature-gates
waitFor:
- push-images
- build-e2e
#
# Run the e2e tests without FeatureGates
#
- name: 'e2e-runner'
args: ['', 'e2e-test-cluster']
id: e2e-stable
waitFor:
- push-images
- build-e2e
#
# SDK conformance tests
#
- name: "make-docker"
id: sdk-conformance
dir: "build"
args: [ "-j", "5", "--output-sync=target", "run-sdk-conformance-tests"]
waitFor:
- build-images
- tests
#
# Cache the CPP conformance build directory, to speed up subsequent builds (considerably)
#
- name: 'gcr.io/$PROJECT_ID/save_cache'
args:
- '--bucket=gs://$_CACHE_BUCKET'
- '--key=$_CPP_SDK_CONFORMANCE_CACHE_KEY-$( checksum sdks/cpp/cmake/prerequisites.cmake )'
- '--path=test/sdk/cpp/sdk'
id: cpp-sdk-conformance-save-cache
waitFor:
- sdk-conformance
#
# Cache the Rust SDK build directory, to speed up subsequent builds (considerably)
#
- name: 'gcr.io/$PROJECT_ID/save_cache'
args:
- '--bucket=gs://$_CACHE_BUCKET'
- '--key=$_RUST_SDK_BUILD_CACHE_KEY-$( checksum test/sdk/rust/Cargo.toml )'
- '--path=test/sdk/rust/.cargo'
- '--path=test/sdk/rust/.cargo-targets'
- '--no-clobber'
id: rust-build-save-cache
waitFor:
- sdk-conformance
#
# Zip up artifacts and push to storage
#
- name: 'gcr.io/cloud-builders/gsutil'
waitFor:
- build-sdks
- tests
dir: "sdks/cpp/.archives"
args: [ '-m', 'cp', '*.tar.gz', 'gs://agones-artifacts/cpp-sdk']
- name: 'gcr.io/cloud-builders/gsutil'
waitFor:
- build-images
- tests
dir: "cmd/sdk-server/bin"
args: [ '-m', 'cp', '*.zip', 'gs://agones-artifacts/sdk-server']
substitutions:
_CACHE_BUCKET: agones-build-cache
_HTMLTEST_CACHE_KEY: htmltest-0.10.1
_CPP_SDK_BUILD_CACHE_KEY: cpp-sdk-build
_CPP_SDK_CONFORMANCE_CACHE_KEY: cpp-sdk-conformance
_RUST_SDK_BUILD_CACHE_KEY: rust-sdk-build
tags: ['ci']
timeout: 7200s
images: ['gcr.io/$PROJECT_ID/agones-controller', 'gcr.io/$PROJECT_ID/agones-ping']
logsBucket: "gs://agones-build-logs"
options:
machineType: 'N1_HIGHCPU_32'