-
Notifications
You must be signed in to change notification settings - Fork 28
/
kubo-deployment-pr.yml
415 lines (391 loc) · 11.4 KB
/
kubo-deployment-pr.yml
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
<%
env_list = %w(vsphere-lb gcp-lb aws-lb)
%>
---
resource_types:
- name: pull-request
type: docker-image
source:
repository: teliaoss/github-pr-resource
- name: gcs
type: docker-image
source:
repository: frodenas/gcs-resource
- name: bosh-deployment
type: docker-image
source:
repository: cloudfoundry/bosh-deployment-resource
- name: bosh-errand
type: docker-image
source:
repository: pcfkubo/bosh2-errand-resource
tag: v0.1.3-dev
resources:
- name: git-bosh-deployment
type: git
source:
uri: [email protected]:cloudfoundry/bosh-deployment.git
branch: master
private_key: ((git-ssh-key.private_key))
- name: git-kubo-ci
type: git
source:
uri: https://github.com/pivotal-cf-experimental/kubo-ci
branch: master
- name: git-kubo-deployment
type: pull-request
source:
repository: cloudfoundry-incubator/kubo-deployment
access_token: ((github-token-key))
<% env_list.each do |env| %>
- name: kubo-lock-<%= env %>
type: pool
source:
uri: [email protected]:pivotal-cf-experimental/kubo-locks.git
branch: master
private_key: ((git-ssh-key.private_key))
pool: kubo-<%= env %>
<% end %>
- name: gcs-bosh-state
type: gcs
source:
json_key: ((gcs-json-key))
bucket: kubo-pipeline-store
versioned_file: bosh/state.json
- name: gcs-bosh-creds
type: gcs
source:
json_key: ((gcs-json-key))
bucket: kubo-pipeline-store
versioned_file: bosh/creds.yml
- name: gcs-kubo-release-tarball
type: gcs
source:
json_key: ((gcs-json-key))
bucket: kubo-public
versioned_file: kubo-release-latest.tgz
- name: source-json
type: gcs
source:
json_key: ((gcs-json-key))
bucket: kubo-pipeline-store
versioned_file: source.json
- name: gcs-load-balancer-vars
type: gcs
source:
json_key: ((gcs-json-key))
bucket: kubo-pipeline-store
versioned_file: load-balancer-vars.yml
- name: cfcr-deployment
type: bosh-deployment
source:
deployment: ci-service
skip_check: true
- name: run-apply-addons-errand
type: bosh-errand
source:
deployment: ci-service
skip_check: true
- name: run-smoke-tests-errand
type: bosh-errand
source:
deployment: ci-service
skip_check: true
- name: gcs-kubeconfig
type: gcs
source:
json_key: ((gcs-json-key))
bucket: kubo-pipeline-store
versioned_file: k8s/config
jobs:
- name: run-unit-tests
plan:
- get: git-kubo-ci
- get: git-kubo-deployment
version: every
- put: git-kubo-deployment
params:
path: git-kubo-deployment
status: pending
- task: run-deployment-unit-tests
file: git-kubo-ci/tasks/run-deployment-unit-tests.yml
on_failure:
put: git-kubo-deployment
params:
path: git-kubo-deployment
status: failure
<% env_list.each do |env| %>
- name: claim-lock-<%= env %>
plan:
- aggregate:
- get: git-kubo-deployment
passed: ['run-unit-tests' ]
version: every
trigger: true
- put: git-kubo-deployment
params:
path: git-kubo-deployment
status: pending
- put: kubo-lock-<%= env %>
params: { acquire: true }
- name: install-bosh-<%= env %>
plan:
- aggregate:
- get: git-kubo-ci
- get: git-bosh-deployment
- get: git-kubo-deployment
passed: [ 'claim-lock-<%= env %>' ]
- get: kubo-lock
resource: kubo-lock-<%= env %>
version: every
trigger: true
passed: [ 'claim-lock-<%= env %>' ]
- put: git-kubo-deployment
params:
path: git-kubo-deployment
status: pending
- task: install
tags: [<%= env %>]
file: git-kubo-ci/tasks/install-bosh.yml
params:
<% if env.include? 'openstack' %>
CLOUD_CONFIG_OPS_FILE: openstack-k8s-cloud-config.yml
<% elsif env =~ /^(gcp|vsphere-lb)/ %>
CLOUD_CONFIG_OPS_FILE: <%= env %>-k8s-cloud-config-multiaz.yml
<% elsif env.include? 'aws-lb' %>
CLOUD_CONFIG_OPS_FILE: aws-k8s-cloud-config-multiaz.yml
<% end %>
on_failure: &on_failure_<%= env %>
aggregate:
- put: git-kubo-deployment
params:
path: git-kubo-deployment
status: failure
- do:
- task: cleanup-<%= env %>
tags: [<%= env %>]
file: git-kubo-ci/tasks/cleanup-<%= env.split('-').first %>-environment.yml
params:
ENV_FILE: kubo-lock/metadata
- put: kubo-lock-<%= env %>
params: { release: kubo-lock }
- aggregate:
- put: gcs-bosh-creds
params:
file: bosh-creds/creds.yml
- put: gcs-bosh-state
params:
file: bosh-state/state.json
- task: generate-load-balancer-vars
file: git-kubo-ci/tasks/generate-load-balancer-vars.yml
- task: generate-source-json
file: git-kubo-ci/tasks/generate-source-json.yml
- aggregate:
- put: gcs-load-balancer-vars
params:
file: load-balancer-vars/vars.yml
- put: source-json
params:
file: source-json/source.json
- task: update-cloud-config-with-vm-ext
tags: ['<%= env %>']
file: git-kubo-ci/tasks/update-cloud-config-with-vm-ext.yml
on_failure: *on_failure_<%= env %>
- name: deploy-k8s-<%= env %>
plan:
- aggregate:
- get: git-kubo-ci
- get: kubo-lock
resource: kubo-lock-<%= env %>
version: every
trigger: true
passed: [ 'install-bosh-<%= env %>' ]
- get: git-kubo-deployment
passed: [ 'install-bosh-<%= env %>' ]
- get: gcs-kubo-release-tarball
- get: gcs-bosh-state
passed: [ 'install-bosh-<%= env %>' ]
- get: gcs-bosh-creds
passed: [ 'install-bosh-<%= env %>' ]
- get: source-json
passed: [ 'install-bosh-<%= env %>' ]
- get: gcs-load-balancer-vars
passed: [ 'install-bosh-<%= env %>' ]
<% if env =~ /^vsphere/ %>
- task: get_director_uuid
tags: ['<%= env %>']
file: git-kubo-ci/tasks/get_director_uuid.yml
<% end %>
- task: upload-stemcell
tags: ['<%= env %>']
file: git-kubo-ci/tasks/upload-stemcell.yml
params:
IAAS: <%= env.split('-')[0] %>
- put: git-kubo-deployment
params:
path: git-kubo-deployment
status: pending
- put: cfcr-deployment
params:
manifest: git-kubo-deployment/manifests/cfcr.yml
cleanup: true
no_redact: true
ops_files:
- git-kubo-ci/manifests/ops-files/kubo-latest-version.yml
- git-kubo-deployment/manifests/ops-files/misc/bootstrap.yml
- git-kubo-deployment/manifests/ops-files/allow-privileged-containers.yml
- git-kubo-deployment/manifests/ops-files/addons-spec.yml
- git-kubo-deployment/manifests/ops-files/enable-nfs.yml
- git-kubo-ci/manifests/ops-files/add-hpa-properties.yml
<% if env =~ /^gcp/ %>
- git-kubo-deployment/manifests/ops-files/iaas/gcp/cloud-provider.yml
- git-kubo-deployment/manifests/ops-files/iaas/gcp/add-subnetwork-for-internal-load-balancer.yml
- git-kubo-deployment/manifests/ops-files/use-vm-extensions.yml
<% end %>
<% if env =~ /^aws/ %>
- git-kubo-deployment/manifests/ops-files/iaas/aws/cloud-provider.yml
- git-kubo-deployment/manifests/ops-files/iaas/aws/lb.yml
- git-kubo-deployment/manifests/ops-files/use-vm-extensions.yml
<% end %>
<% if env =~ /^openstack/ %>
- git-kubo-deployment/manifests/ops-files/iaas/openstack/cloud-provider.yml
<% end %>
<% if env =~ /^vsphere/ %>
- git-kubo-deployment/manifests/ops-files/iaas/vsphere/cloud-provider.yml
- git-kubo-deployment/manifests/ops-files/iaas/vsphere/use-vm-extensions.yml
<% end %>
var_files:
addons-spec: "/tmp/build/put/git-kubo-ci/specs/guestbook.yml"
vars_files:
- gcs-load-balancer-vars/load-balancer-vars.yml
- kubo-lock/metadata
<% if env =~ /^vsphere/ %>
- director_uuid/var.yml
<% end %>
releases:
- gcs-kubo-release-tarball/*.tgz
source_file: source-json/source.json
vars:
deployment_name: ci-service
worker_count: 3
tags: [<%= env %>]
on_failure: *on_failure_<%= env %>
- task: update-kubeconfig
tags: ['<%= env %>']
file: git-kubo-ci/tasks/update-kubeconfig.yml
- put: run-apply-addons-errand
params:
name: apply-addons
keep_alive: true
source_file: source-json/source.json
tags: [<%= env %>]
on_failure: *on_failure_<%= env %>
- put: run-smoke-tests-errand
params:
name: smoke-tests
keep_alive: true
source_file: source-json/source.json
tags: [<%= env %>]
on_failure: *on_failure_<%= env %>
- put: gcs-kubeconfig
params:
file: kubeconfig/config
- name: run-k8s-integration-tests-<%= env %>
plan:
- aggregate:
- get: git-kubo-ci
- get: kubo-lock
resource: kubo-lock-<%= env %>
version: every
trigger: true
passed: [ 'deploy-k8s-<%= env %>' ]
- get: git-kubo-deployment
passed: [ 'deploy-k8s-<%= env %>' ]
- get: gcs-bosh-state
passed: [ 'deploy-k8s-<%= env %>' ]
- get: gcs-bosh-creds
passed: [ 'deploy-k8s-<%= env %>' ]
- get: source-json
passed: [ 'deploy-k8s-<%= env %>' ]
- get: gcs-kubeconfig
passed: [ 'deploy-k8s-<%= env %>' ]
- put: git-kubo-deployment
params:
path: git-kubo-deployment
status: pending
- task: integration-tests
tags: [<%= env %>]
file: git-kubo-ci/tasks/run-k8s-integration-tests.yml
on_failure: *on_failure_<%= env %>
params:
DEPLOYMENT_NAME: ci-service
ENABLE_ADDONS_TESTS: true
ENABLE_API_EXTENSIONS_TESTS: true
ENABLE_CERTIFICATE_TESTS: true
ENABLE_GENERIC_TESTS: true
ENABLE_PERSISTENT_VOLUME_TESTS: true
<% if env =~ /^(vsphere|openstack)/ %>
ENABLE_K8S_LBS_TESTS: false
<% end %>
- name: destroy-k8s-<%= env %>
plan:
- aggregate:
- get: git-kubo-ci
- get: kubo-lock
resource: kubo-lock-<%= env %>
version: every
trigger: true
passed: [ 'run-k8s-integration-tests-<%= env %>' ]
- get: git-kubo-deployment
passed: [ 'run-k8s-integration-tests-<%= env %>' ]
- get: gcs-bosh-state
passed: [ 'run-k8s-integration-tests-<%= env %>' ]
- get: gcs-bosh-creds
passed: [ 'run-k8s-integration-tests-<%= env %>' ]
- get: source-json
passed: [ 'run-k8s-integration-tests-<%= env %>' ]
- put: git-kubo-deployment
params:
path: git-kubo-deployment
status: pending
- task: destroy-k8s
tags: [<%= env %>]
file: git-kubo-ci/tasks/destroy-k8s-instance.yml
on_failure: *on_failure_<%= env %>
- name: destroy-bosh-<%= env %>
plan:
- aggregate:
- get: git-kubo-ci
- get: git-bosh-deployment
- get: git-kubo-deployment
passed: [ 'destroy-k8s-<%= env %>' ]
- get: kubo-lock
resource: kubo-lock-<%= env %>
version: every
trigger: true
passed: [ 'destroy-k8s-<%= env %>' ]
- get: gcs-bosh-state
passed: [ 'destroy-k8s-<%= env %>' ]
- get: gcs-bosh-creds
passed: [ 'destroy-k8s-<%= env %>' ]
- put: git-kubo-deployment
params:
path: git-kubo-deployment
status: pending
- task: destroy
tags: [<%= env %>]
file: git-kubo-ci/tasks/destroy-bosh.yml
on_failure: *on_failure_<%= env %>
- put: kubo-lock-<%= env %>
params: { release: kubo-lock }
<% end %>
- name: success-notification
plan:
- get: git-kubo-deployment
passed: <%= env_list.collect { |env| "destroy-bosh-#{env}" } %>
trigger: true
- get: git-kubo-ci
- put: git-kubo-deployment
params:
path: git-kubo-deployment
status: success