-
Notifications
You must be signed in to change notification settings - Fork 89
/
pipeline.yml
713 lines (673 loc) · 21.2 KB
/
pipeline.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
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
---
shared:
- &azure-environment-params
AZURE_ENVIRONMENT: AzureCloud
AZURE_TENANT_ID: ((cpi_azure_credentials_json.tenant_id))
AZURE_SUBSCRIPTION_ID: ((cpi_azure_credentials_json.subscription_id))
AZURE_CLIENT_ID: ((cpi_azure_credentials_json.client_id))
AZURE_CLIENT_SECRET: ((cpi_azure_credentials_json.client_secret))
AZURE_CERTIFICATE: |
((bosh-azure-cpi/cpi_certificate_auth.private_key))
((bosh-azure-cpi/cpi_certificate_auth.certificate))
- &create-bats-environment
put: environment
tags: [azure]
params:
delete_on_failure: true
generate_random_name: true
terraform_source: pipelines/azure/assets/terraform
- &create-az-bats-environment
put: environment
tags: [azure]
params:
delete_on_failure: true
generate_random_name: true
terraform_source: bosh-cpi-src/ci/assets/terraform/az_bats
- &destroy-bats-environment
put: environment
tags: [azure]
params:
action: destroy
env_name_file: environment/name
terraform_source: pipelines/azure/assets/terraform
get_params:
action: destroy
- &destroy-az-bats-environment
put: environment
tags: [azure]
params:
action: destroy
env_name_file: environment/name
terraform_source: bosh-cpi-src/ci/assets/terraform/az_bats
get_params:
action: destroy
- &prepare-director
task: prepare-director
file: pipelines/shared/tasks/prepare-director.yml
image: bosh-integration-registry-image
params: &prepare-director-params
INFRASTRUCTURE: azure
DIRECTOR_VARS_FILE: |
subscription_id: ((cpi_azure_credentials_json.subscription_id))
tenant_id: ((cpi_azure_credentials_json.tenant_id))
client_id: ((cpi_azure_credentials_json.client_id))
client_secret: ((cpi_azure_credentials_json.client_secret))
dns_recursor_ip: 8.8.8.8
- &load-current-ruby-version-using-load_var
load_var: ruby_version
file: "bosh-cpi-src/src/bosh_azure_cpi/.ruby-version"
format: raw
reveal: true
- &deploy-director
task: deploy-director
tags: [azure]
file: pipelines/shared/tasks/deploy-director.yml
image: bosh-integration-registry-image
params:
RUBY_VERSION: ((.:ruby_version))
- &run-bats
task: run-bats
tags: [azure]
file: pipelines/shared/tasks/run-bats.yml
image: bosh-integration-registry-image
params: &run-bats-params
INFRASTRUCTURE: azure
STEMCELL_NAME: bosh-azure-hyperv-ubuntu-jammy-go_agent
BAT_INFRASTRUCTURE: azure
BAT_RSPEC_FLAGS: "--tag ~raw_ephemeral_storage"
RUBY_VERSION: ((.:ruby_version))
- &run-az-bats
task: run-az-bats
tags: [azure]
file: bosh-cpi-src/ci/tasks/run-az-bats.yml
params: &run-az-bats-params
INFRASTRUCTURE: azure
STEMCELL_NAME: bosh-azure-hyperv-ubuntu-jammy-go_agent
BAT_INFRASTRUCTURE: azure
BAT_RSPEC_FLAGS: "--tag ~raw_ephemeral_storage"
AZURE_BATS_ZONE: "1"
- &teardown
task: teardown
tags: [azure]
image: bosh-integration-registry-image
file: pipelines/shared/tasks/teardown.yml
params:
RUBY_VERSION: ((.:ruby_version))
- &create-integration-environment
put: environment
tags: [azure]
params:
delete_on_failure: true
generate_random_name: true
terraform_source: bosh-cpi-src/ci/assets/terraform/integration
- &destroy-integration-environment
put: environment
tags: [azure]
params:
action: destroy
env_name_file: environment/name
terraform_source: bosh-cpi-src/ci/assets/terraform/integration
get_params:
action: destroy
- &upload-stemcell
task: upload-stemcell
tags: [azure]
file: bosh-cpi-src/ci/tasks/upload-stemcell.yml
params: &upload-stemcell-params
<<: *azure-environment-params
- &run-integration
task: run-integration
tags: [azure]
file: bosh-cpi-src/ci/tasks/run-integration.yml
params: &run-integration-params
<<: *azure-environment-params
SSH_PUBLIC_KEY: ((bosh-azure-cpi/integration_vm_keypair.public_key))
- &run-integration-windows
task: run-integration-windows
tags: [azure]
file: bosh-cpi-src/ci/tasks/run-integration-windows.yml
params: &run-integration-windows-params
<<: *run-integration-params
- &ensure-cleanup
task: ensure-cleanup
tags: [azure]
file: bosh-cpi-src/ci/tasks/ensure-cleanup.yml
params:
<<: *azure-environment-params
jobs:
- name: unit-specs
plan:
- in_parallel:
- get: bosh-cpi-src
resource: bosh-cpi-src-in
trigger: true
- get: bosh-integration-registry-image
- task: run-unit-specs
tags: [ azure ]
file: bosh-cpi-src/ci/tasks/run-unit-specs.yml
image: bosh-integration-registry-image
- name: integration-unmanaged-disks
serial: true
serial_groups: [integration-unmanaged-disks]
plan:
- in_parallel:
- {get: bosh-cpi-src, trigger: true, resource: bosh-cpi-src-in, passed: [unit-specs]}
- {get: stemcell, trigger: false, resource: azure-ubuntu-stemcell, tags: [azure]}
- <<: *create-integration-environment
- do:
- <<: *upload-stemcell
- <<: *run-integration
params:
<<: *run-integration-params
AZURE_USE_MANAGED_DISKS: false
ensure:
do:
- <<: *destroy-integration-environment
ensure:
do:
- <<: *ensure-cleanup
- name: integration-managed-disks
serial: true
serial_groups: [integration-managed-disks]
plan:
- in_parallel:
- {get: bosh-cpi-src, trigger: true, resource: bosh-cpi-src-in, passed: [unit-specs]}
- {get: stemcell, trigger: false, resource: azure-ubuntu-stemcell, tags: [azure]}
- <<: *create-integration-environment
- do:
- <<: *upload-stemcell
- <<: *run-integration
params:
<<: *run-integration-params
AZURE_USE_MANAGED_DISKS: true
ensure:
do:
- <<: *destroy-integration-environment
ensure:
do:
- <<: *ensure-cleanup
- name: integration-windows-unmanaged-disks
serial: true
serial_groups: [integration-windows-unmanaged-disks]
plan:
- in_parallel:
- {get: bosh-cpi-src, trigger: true, resource: bosh-cpi-src-in, passed: [unit-specs]}
- {get: stemcell, trigger: false, resource: azure-windows-stemcell, tags: [azure]}
- <<: *create-integration-environment
- do:
- <<: *upload-stemcell
params:
<<: *azure-environment-params
IS_HEAVY_STEMCELL: false
- <<: *run-integration-windows
params:
<<: *run-integration-windows-params
AZURE_USE_MANAGED_DISKS: false
ensure:
do:
- <<: *destroy-integration-environment
ensure:
do:
- <<: *ensure-cleanup
- name: integration-windows-managed-disks
serial: true
serial_groups: [integration-windows-managed-disks]
plan:
- in_parallel:
- {get: bosh-cpi-src, trigger: true, resource: bosh-cpi-src-in, passed: [unit-specs]}
- {get: stemcell, trigger: false, resource: azure-windows-stemcell, tags: [azure]}
- <<: *create-integration-environment
- do:
- <<: *upload-stemcell
params:
<<: *azure-environment-params
IS_HEAVY_STEMCELL: false
- <<: *run-integration-windows
params:
<<: *run-integration-windows-params
AZURE_USE_MANAGED_DISKS: true
ensure:
do:
- <<: *destroy-integration-environment
ensure:
do:
- <<: *ensure-cleanup
- name: bats-unmanaged-disks
serial: true
serial_groups: [bats-unmanaged-disks]
plan:
- in_parallel:
- get: bosh-release
resource: bosh-release
- get: bosh-cpi-src
resource: bosh-cpi-src-in
passed: [unit-specs]
trigger: true
- get: stemcell
trigger: true
resource: azure-ubuntu-stemcell
tags: [azure]
- get: bosh-deployment
- get: pipelines
- get: bats
- get: bosh-integration-registry-image
- task: build-candidate
file: bosh-cpi-src/ci/tasks/build-candidate.yml
- <<: *create-bats-environment
- do:
- <<: *prepare-director
params:
<<: *prepare-director-params
OPTIONAL_OPS_FILE: |
-o pipelines/shared/assets/ops/remove-hm.yml
-o bosh-deployment/external-ip-not-recommended.yml
- do:
- <<: *load-current-ruby-version-using-load_var
- <<: *deploy-director
- <<: *run-bats
ensure:
do:
- <<: *teardown
ensure:
do:
- <<: *destroy-bats-environment
ensure:
do:
- <<: *ensure-cleanup
- name: bats-managed-disks
serial: true
serial_groups: [bats-managed-disks]
plan:
- in_parallel:
- get: bosh-release
resource: bosh-release
- get: bosh-cpi-src
resource: bosh-cpi-src-in
passed: [unit-specs]
trigger: true
- get: stemcell
resource: azure-ubuntu-stemcell
tags: [azure]
- get: bosh-deployment
- get: pipelines
- get: bats
- get: bosh-integration-registry-image
- task: build-candidate
file: bosh-cpi-src/ci/tasks/build-candidate.yml
- <<: *create-az-bats-environment
- do:
- <<: *prepare-director
params:
<<: *prepare-director-params
OPTIONAL_OPS_FILE: |
-o pipelines/shared/assets/ops/remove-hm.yml
-o bosh-deployment/external-ip-not-recommended.yml
-o bosh-deployment/azure/use-managed-disks.yml
- do:
- <<: *load-current-ruby-version-using-load_var
- <<: *deploy-director
- <<: *run-az-bats
ensure:
do:
- <<: *teardown
ensure:
do:
- <<: *destroy-az-bats-environment
ensure:
do:
- <<: *ensure-cleanup
- name: cleanup-leftover-environments
serial_groups:
- integration-unmanaged-disks
- integration-managed-disks
- integration-windows-unmanaged-disks
- integration-windows-managed-disks
- bats-unmanaged-disks
- bats-managed-disks
plan:
- in_parallel:
- get: bosh-integration-registry-image
- get: bosh-azure-cpi-release
resource: bosh-cpi-src-in
- get: daily
trigger: true
- task: cleanup-leftover-environments
file: bosh-azure-cpi-release/ci/tasks/cleanup-leftover-environments.yml
image: bosh-integration-registry-image
- name: release-fan-in
plan:
- get: bosh-cpi-src-in
trigger: true
passed:
- integration-unmanaged-disks
- integration-managed-disks
- integration-windows-unmanaged-disks
- integration-windows-managed-disks
- bats-unmanaged-disks
- bats-managed-disks
- name: bump-major
serial_groups: [ version ]
plan:
- put: release-version-semver
params:
bump: major
- name: bump-minor
serial_groups: [ version ]
plan:
- put: release-version-semver
params:
bump: minor
- name: bump-patch
serial_groups: [ version ]
plan:
- put: release-version-semver
params:
bump: patch
- name: automatically-release-new-patch
serial_groups: [ version ]
plan:
- in_parallel:
- get: bosh-cpi-src-in
trigger: true
passed:
- release-fan-in
- get: bosh-shared-ci
- get: version
resource: release-version-semver
- get: bosh-security-scanner-registry-image
- try:
task: check-for-updated-vendored-packages
file: bosh-shared-ci/tasks/release/check-for-updated-vendored-packages.yml
image: bosh-security-scanner-registry-image
input_mapping:
input_repo: bosh-cpi-src-in
params:
PACKAGES: [azure-cpi-ruby-3.3]
- try:
task: check-for-patched-cves
file: bosh-shared-ci/tasks/release/check-for-patched-cves.yml
image: bosh-security-scanner-registry-image
input_mapping:
input_repo: bosh-cpi-src-in
params:
SEVERITY: CRITICAL,HIGH
- task: ensure-cve-checker-succeeded
file: bosh-shared-ci/tasks/release/ensure-task-succeeded.yml
image: bosh-security-scanner-registry-image
input_mapping:
task-output-folder: patched_cves
- try:
task: check-needs-release
config:
platform: linux
image_resource:
type: docker-image
source: {repository: alpine}
inputs:
- name: release-notes
run:
path: /bin/sh
args:
- -c
- |
if [ -f release-notes/needs-release ]; then
echo "## Release Notes"
echo "${release-notes/release-notes.md}"
exit 0
else
echo "No release needed"
exit 1
fi
on_success:
do:
- put: release-notes
params:
file: release-notes/release-notes.md
- put: release-version-semver
params:
bump: patch
- name: promote-candidate
old_name: promote-candidate-major
plan:
- in_parallel:
- get: bosh-cpi-src
resource: bosh-cpi-src-in
passed:
- release-fan-in
- get: release-version-semver
trigger: true
- get: release-notes
- get: bosh-shared-ci
- task: promote
file: bosh-shared-ci/tasks/release/create-final-release.yml
input_mapping:
release_repo: bosh-cpi-src
version: release-version-semver
params:
GIT_USER_NAME: CI Bot
GIT_USER_EMAIL: [email protected]
PRIVATE_YML: |
---
blobstore:
provider: gcs
options:
credentials_source: static
json_key: '((cloud-foundry-gcp-credentials))'
- put: bosh-cpi-src-out
params: {repository: release_repo, rebase: true, tag: release_metadata/tag-name}
- put: bosh-azure-cpi-release-github-release
params:
name: release_metadata/tag-name
tag: release_metadata/tag-name
body: release-notes/release-notes
commitish: bosh-cpi-src-out/.git/ref
generate_release_notes: true
- put: release-notes
params:
file: release_metadata/empty-file
- name: bump-deps
plan:
- in_parallel:
- get: bosh-cpi-src
resource: bosh-cpi-src-in
- get: ruby-release
- get: bosh-ruby-release-registry-image
- get: bosh-integration-registry-image
- get: weekly
trigger: true
- task: bump-gems
image: bosh-ruby-release-registry-image
file: ruby-release/ci/tasks/shared/bump-gems.yml
input_mapping:
input-repo: bosh-cpi-src
output_mapping:
output-repo: bosh-cpi-src
params:
GEM_DIRS: src/bosh_azure_cpi
GIT_USER_NAME: CI Bot
GIT_USER_EMAIL: [email protected]
PACKAGE: ruby-3.3
VENDOR: true
- task: run-unit-specs
tags: [ azure ]
file: bosh-cpi-src/ci/tasks/run-unit-specs.yml
image: bosh-integration-registry-image
- put: bosh-cpi-src-out
params:
repository: bosh-cpi-src
rebase: true
- name: bump-bosh-packages
plan:
- in_parallel:
- get: bosh-cpi-src
resource: bosh-cpi-src-in
- get: ruby-release
trigger: true
- get: bosh-ecosystem-concourse-image
- get: bosh-integration-registry-image
- task: bump-ruby-package
image: bosh-ecosystem-concourse-image
file: ruby-release/ci/tasks/shared/bump-ruby-package.yml
input_mapping:
bosh-release: bosh-cpi-src
output_mapping:
bosh-release: bosh-cpi-src
params:
GIT_USER_NAME: CI Bot
GIT_USER_EMAIL: [email protected]
PACKAGE: ruby-3.3
PACKAGE_PREFIX: azure-cpi
PRIVATE_YML: |
---
blobstore:
provider: gcs
options:
credentials_source: static
json_key: '((cloud-foundry-gcp-credentials))'
RUBY_VERSION_PATH: src/bosh_azure_cpi/.ruby-version
- task: run-unit-specs
tags: [ azure ]
file: bosh-cpi-src/ci/tasks/run-unit-specs.yml
image: bosh-integration-registry-image
- put: bosh-cpi-src-out
params:
repository: bosh-cpi-src
rebase: true
resource_types:
- name: terraform_type
type: docker-image
source:
repository: ljfranklin/terraform-resource
- name: semver
type: docker-image
source:
repository: concourse/semver-resource
tag: 1.6
- name: gcs
type: registry-image
source:
repository: frodenas/gcs-resource
username: ((docker.username))
password: ((docker.password))
resources:
- name: bosh-shared-ci
type: git
source:
uri: [email protected]:cloudfoundry/bosh-shared-ci.git
private_key: ((github_deploy_key_bosh-shared-ci.private_key))
- name: bosh-integration-registry-image
type: registry-image
source:
repository: bosh/integration
username: ((docker.username))
password: ((docker.password))
- name: bosh-cpi-src-in
type: git
source:
uri: https://github.com/cloudfoundry/bosh-azure-cpi-release.git
branch: master
ignore_paths:
- .final_builds/**/*.yml
- releases/**/*.yml
- name: bosh-cpi-src-out
type: git
source:
uri: [email protected]:cloudfoundry/bosh-azure-cpi-release.git
branch: master
private_key: ((github_deploy_key_bosh-azure-cpi-release.private_key))
- name: release-version-semver
type: semver
source:
driver: git
branch: release-semver
file: VERSION
uri: [email protected]:cloudfoundry/bosh-azure-cpi-release.git
private_key: ((github_deploy_key_bosh-azure-cpi-release.private_key))
initial_version: '50.0.0'
- name: release-notes
type: gcs
source:
versioned_file: release-notes
bucket: bosh-azure-cpi-blobs
json_key: ((cloud-foundry-gcp-credentials))
- name: bosh-azure-cpi-release-github-release
type: github-release
source:
owner: cloudfoundry
repository: bosh-azure-cpi-release
access_token: ((github_public_repo_token))
- name: environment
type: terraform_type
source:
backend_type: gcs
backend_config:
bucket: bosh-azure-cpi-blobs
prefix: terraform
credentials: ((cloud-foundry-gcp-credentials))
vars:
location: eastus2
azure_environment: AzureCloud
azure_subscription_id: ((cpi_azure_credentials_json.subscription_id))
azure_client_id: ((cpi_azure_credentials_json.client_id))
azure_client_secret: ((cpi_azure_credentials_json.client_secret))
azure_tenant_id: ((cpi_azure_credentials_json.tenant_id))
resource_group_prefix: azurecpi
- name: pipelines
type: git
source:
uri: https://github.com/cloudfoundry-incubator/bosh-cpi-certification
branch: master
- name: bosh-release
type: bosh-io-release
source:
repository: cloudfoundry/bosh
- name: azure-ubuntu-stemcell
type: bosh-io-stemcell
source:
name: bosh-azure-hyperv-ubuntu-jammy-go_agent
- name: azure-windows-stemcell
type: bosh-io-stemcell
source:
name: bosh-azure-hyperv-windows2019-go_agent
- name: bats
type: git
source:
uri: https://github.com/cloudfoundry/bosh-acceptance-tests.git
branch: master
- name: bosh-deployment
type: git
source:
uri: https://github.com/cloudfoundry/bosh-deployment
branch: master
- name: bosh-ruby-release-registry-image
type: registry-image
source:
repository: bosh/ruby-release
username: ((docker.username))
password: ((docker.password))
- name: ruby-release
type: git
source:
uri: https://github.com/cloudfoundry/bosh-package-ruby-release.git
- name: bosh-ecosystem-concourse-image
type: registry-image
source:
repository: bosh/bosh-ecosystem-concourse
username: ((docker.username))
password: ((docker.password))
- name: bosh-security-scanner-registry-image
type: registry-image
source:
repository: bosh/security-scanner
username: ((docker.username))
password: ((docker.password))
- name: weekly
type: time
source:
start: 3:00 -0700
stop: 4:30 -0700
days: [ Saturday ]
- name: daily
type: time
source:
interval: 24h