forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stages.yml
933 lines (863 loc) · 36.5 KB
/
stages.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
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
parameters:
## Build stages
# NB: all stages _must_ depend on `env`
- name: buildStageDeps
displayName: "Build stage dependencies"
type: object
default:
- env
- prechecks
- name: macBuildStageDeps
displayName: "macOS stage dependencies"
type: object
default:
- env
- prechecks
- name: windowsBuildStageDeps
displayName: "Windows stage dependencies"
type: object
default:
- env
- prechecks
- name: checkStageDeps
displayName: "Check stage dependencies"
type: object
default:
- env
- linux_x64
- name: checksConcurrency
displayName: "Check concurrency"
type: number
default: 3
- name: concurrencyPrechecks
displayName: "Prechhecks concurrency"
type: number
default: 10
## Timeouts
- name: timeoutDockerPublish
displayName: "Timout Docker publish"
type: number
default: 10
## Build settings
- name: cacheTestResults
displayName: "Cache test results"
type: boolean
default: true
stages:
- stage: env
displayName: Environment
jobs:
- template: env.yml
- stage: prechecks
displayName: Prechecks
dependsOn: ["env"]
jobs:
- job: prechecks
displayName: Precheck
timeoutInMinutes: 20
pool:
vmImage: "ubuntu-20.04"
variables:
AUTH_GITHUB: ""
CI_TARGET: ""
CHECK_DEPS: $[eq(stageDependencies.env.repo.outputs['changed.requirements'], true)]
strategy:
maxParallel: ${{ parameters.concurrencyPrechecks }}
matrix:
format:
CI_TARGET: "format"
protobuf:
CI_TARGET: "check_and_fix_proto_format"
${{ if eq(variables.CHECK_DEPS, true) }}:
dependencies:
CI_TARGET: deps
AUTH_GITHUB: $(GitHubPublicRepoOnlyAccessToken)
publishing:
CI_TARGET: docs
steps:
- template: bazel.yml
parameters:
ciTarget: $(CI_TARGET)
cacheTestResults: ${{ parameters.cacheTestResults }}
cacheVersion: $(cacheKeyBazel)
publishEnvoy: false
publishTestResults: false
authGithub: $(AUTH_GITHUB)
stepsPost:
# Format fixes
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: "$(Build.StagingDirectory)/fix_format.diff"
artifactName: format
timeoutInMinutes: 10
# not all have fixes so improve condition/handling
condition: and(failed(), eq(variables['CI_TARGET'], 'format'))
# Protobuf fixes
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: "$(Build.StagingDirectory)/fix_proto_format.diff"
artifactName: format
timeoutInMinutes: 10
condition: and(failed(), eq(variables['CI_TARGET'], 'protobuf'))
# Publish docs
- script: |
ci/run_envoy_docker.sh 'ci/upload_gcs_artifact.sh /source/generated/docs docs'
displayName: "Upload Docs to GCS"
env:
ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory)
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
GCS_ARTIFACT_BUCKET: $(GcsArtifactBucket)
condition: eq(variables['CI_TARGET'], 'docs')
# Docker regression tests
- script: |
DOCKER_CI_FIX_DIFF=$(Build.StagingDirectory)/fix_docker.diff DOCKER_CI_FIX=1 ci/test_docker_ci.sh
workingDirectory: $(Build.SourcesDirectory)
displayName: Docker build regression test
condition: eq(variables['CI_TARGET'], 'docs')
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: "$(Build.StagingDirectory)/fix_docker.diff"
artifactName: "docker_ci"
timeoutInMinutes: 10
condition: and(failed(), eq(variables['CI_TARGET'], 'docs'))
- job: prechecked
displayName: Prechecked
dependsOn: ["prechecks"]
pool:
vmImage: "ubuntu-20.04"
# This condition ensures that this (required) job passes if all of
# the preceeding jobs either pass or are skipped
# adapted from:
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#job-to-job-dependencies-within-one-stage
condition: |
and(
eq(variables['Build.Reason'], 'PullRequest'),
in(dependencies.prechecks.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'))
steps:
- checkout: none
- bash: |
echo "Prechecked"
- stage: sync
condition: and(succeeded(), eq(variables['PostSubmit'], true), ne(variables['NoSync'], true))
dependsOn: []
jobs:
- job: filter_example
dependsOn: []
pool:
vmImage: "ubuntu-20.04"
steps:
- checkout: self
fetchDepth: 0
fetchTags: true
- task: InstallSSHKey@0
inputs:
hostName: "github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk="
sshPublicKey: "$(FilterExamplePublicKey)"
sshPassphrase: "$(SshDeployKeyPassphrase)"
sshKeySecureFile: "$(FilterExamplePrivateKey)"
- bash: ci/filter_example_mirror.sh
displayName: "Sync envoy-filter-example"
workingDirectory: $(Build.SourcesDirectory)
env:
AZP_BRANCH: $(Build.SourceBranch)
- job: data_plane_api
dependsOn: []
pool:
vmImage: "ubuntu-20.04"
steps:
- checkout: self
fetchDepth: 0
fetchTags: true
- task: InstallSSHKey@0
inputs:
hostName: "github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk="
sshPublicKey: "$(DataPlaneApiPublicKey)"
sshPassphrase: "$(SshDeployKeyPassphrase)"
sshKeySecureFile: "$(DataPlaneApiPrivateKey)"
- bash: ci/api_mirror.sh
displayName: "Sync data-plane-api"
workingDirectory: $(Build.SourcesDirectory)
env:
AZP_BRANCH: $(Build.SourceBranch)
- job: go_control_plane
dependsOn: []
pool:
vmImage: "ubuntu-20.04"
steps:
- checkout: self
fetchDepth: 0
fetchTags: true
- task: InstallSSHKey@0
inputs:
hostName: "github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk="
sshPublicKey: "$(GoControlPlanePublicKey)"
sshPassphrase: "$(SshDeployKeyPassphrase)"
sshKeySecureFile: "$(GoControlPlanePrivateKey)"
- bash: |
cp -a ~/.ssh $(Build.StagingDirectory)/
ci/run_envoy_docker.sh 'ci/go_mirror.sh'
displayName: "Sync go-control-plane"
workingDirectory: $(Build.SourcesDirectory)
env:
ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory)
BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com
BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
AZP_BRANCH: $(Build.SourceBranch)
- stage: linux_x64
displayName: Linux x64
dependsOn: ${{ parameters.buildStageDeps }}
# For post-submit builds, continue even if precheck fails
condition: and(not(canceled()), or(succeeded(), eq(variables['PostSubmit'], true)))
jobs:
- job: release
displayName: Build and test
condition: and(not(canceled()), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'))
timeoutInMinutes: 120
pool: envoy-x64-large
steps:
- template: bazel.yml
parameters:
managedAgent: false
ciTarget: bazel.release
bazelBuildExtraOptions: "--sandbox_base=/tmp/sandbox_base"
cacheTestResults: ${{ parameters.cacheTestResults }}
cacheVersion: $(cacheKeyBazel)
- job: released
displayName: Complete
dependsOn: ["release"]
pool:
vmImage: "ubuntu-20.04"
# This condition ensures that this (required) job passes if all of
# the preceeding jobs either pass or are skipped
# adapted from:
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#job-to-job-dependencies-within-one-stage
condition: and(eq(variables['Build.Reason'], 'PullRequest'), in(dependencies.release.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'))
steps:
- checkout: none
- bash: |
echo "linux_x64 released"
- stage: linux_arm64
displayName: Linux arm64
dependsOn: ${{ parameters.buildStageDeps }}
# For post-submit builds, continue even if precheck fails
condition: and(not(canceled()), or(succeeded(), eq(variables['PostSubmit'], true)))
jobs:
- job: release
displayName: Build and test
condition: and(not(canceled()), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'))
timeoutInMinutes: 180
pool: "envoy-arm-large"
steps:
- template: bazel.yml
parameters:
managedAgent: false
ciTarget: bazel.release
rbe: false
artifactSuffix: ".arm64"
bazelBuildExtraOptions: "--sandbox_base=/tmp/sandbox_base"
cacheTestResults: ${{ parameters.cacheTestResults }}
- job: released
displayName: Complete
dependsOn: ["release"]
pool:
vmImage: "ubuntu-20.04"
# This condition ensures that this (required) job passes if all of
# the preceeding jobs either pass or are skipped
# adapted from:
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#job-to-job-dependencies-within-one-stage
condition: and(eq(variables['Build.Reason'], 'PullRequest'), in(dependencies.release.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'))
steps:
- checkout: none
- bash: |
echo "linux_arm64 released"
- stage: check
displayName: Checks (Linux x64)
dependsOn: ${{ parameters.checkStageDeps }}
jobs:
- job: bazel
displayName: "Linux x64"
dependsOn: []
# Skip checks if only mobile/ or docs/ have changed.
condition: and(not(canceled()), or(succeeded(), eq(variables['PostSubmit'], true)), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.examplesOnly'], 'true'))
variables:
REPO_FETCH_DEPTH: 1
REPO_FETCH_TAGS: false
PUBLISH_TEST_RESULTS: true
PUBLISH_ENVOY: true
strategy:
maxParallel: ${{ parameters.checksConcurrency }}
matrix:
# These are ordered by most time-consuming first.
compile_time_options:
CI_TARGET: "bazel.compile_time_options"
ENVOY_FILTER_EXAMPLE: true
tsan:
CI_TARGET: "bazel.tsan"
asan:
CI_TARGET: "bazel.asan"
ENVOY_FILTER_EXAMPLE: true
# Disabled due to https://github.com/envoyproxy/envoy/pull/18218
# api_compat:
# CI_TARGET: "bazel.api_compat"
gcc:
CI_TARGET: "bazel.gcc"
msan:
CI_TARGET: "bazel.msan"
ENVOY_FILTER_EXAMPLE: true
clang_tidy:
CI_TARGET: "bazel.clang_tidy"
REPO_FETCH_DEPTH: 0
REPO_FETCH_TAGS: true
PUBLISH_TEST_RESULTS: false
PUBLISH_ENVOY: false
api:
CI_TARGET: "bazel.api"
timeoutInMinutes: 180
pool:
vmImage: "ubuntu-20.04"
steps:
- template: bazel.yml
parameters:
ciTarget: $(CI_TARGET)
envoyBuildFilterExample: $(ENVOY_FILTER_EXAMPLE)
cacheTestResults: ${{ parameters.cacheTestResults }}
repoFetchDepth: $(REPO_FETCH_DEPTH)
repoFetchTags: $(REPO_FETCH_TAGS)
publishTestResults: $(PUBLISH_TEST_RESULTS)
publishEnvoy: $(PUBLISH_ENVOY)
stepsPost:
# TODO(phlax): consolidate "fix" paths/jobs
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: "$(Build.StagingDirectory)/tmp/lint-fixes"
artifactName: "$(CI_TARGET).fixes"
timeoutInMinutes: 10
condition: and(failed(), eq(variables['CI_TARGET'], 'bazel.clang_tidy'))
- job: coverage
displayName: "Linux x64"
dependsOn: []
# Skip checks if only mobile/ or docs/ have changed.
condition: and(not(canceled()), or(succeeded(), eq(variables['PostSubmit'], true)), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.examplesOnly'], 'true'))
timeoutInMinutes: 240
pool: "envoy-x64-large"
strategy:
maxParallel: 2
matrix:
coverage:
CI_TARGET: "coverage"
fuzz_coverage:
CI_TARGET: "fuzz_coverage"
steps:
- template: bazel.yml
parameters:
managedAgent: false
ciTarget: bazel.$(CI_TARGET)
rbe: false
# /tmp/sandbox_base is a tmpfs in CI environment to optimize large I/O for coverage traces
bazelBuildExtraOptions: "--define=no_debug_info=1 --linkopt=-Wl,-s --test_env=ENVOY_IP_TEST_VERSIONS=v4only --sandbox_base=/tmp/sandbox_base"
cacheTestResults: ${{ parameters.cacheTestResults }}
- script: ci/run_envoy_docker.sh 'ci/upload_gcs_artifact.sh /source/generated/$(CI_TARGET) $(CI_TARGET)'
displayName: "Upload $(CI_TARGET) Report to GCS"
env:
ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory)
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
GCS_ARTIFACT_BUCKET: $(GcsArtifactBucket)
condition: always()
- job: complete
displayName: "Checks complete"
dependsOn: ["bazel", "coverage"]
pool:
vmImage: "ubuntu-20.04"
# This condition ensures that this (required) check passes if all of
# the preceding checks either pass or are skipped
# adapted from:
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#job-to-job-dependencies-within-one-stage
condition: |
and(
eq(variables['Build.Reason'], 'PullRequest'),
in(dependencies.bazel.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.coverage.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'))
steps:
- checkout: none
- bash: |
echo "checks complete"
- stage: publish
displayName: Publish
dependsOn: ["env", "linux_x64", "linux_arm64"]
jobs:
- job: docker
displayName: "Docker (Linux multi arch)"
condition: and(not(canceled()), succeeded(), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'))
timeoutInMinutes: 120
pool:
vmImage: "ubuntu-20.04"
steps:
- bash: |
set -e
# This is necessary as the azp version of Docker (~21.0) can hang when adding tarballs
# in a build (https://github.com/moby/buildkit/issues/3801)
# Update instructions lifted from https://docs.docker.com/engine/install/ubuntu/
export DEBIAN_FRONTEND=noninteractive
# This is almost certainly not necessary but the canonical way
sudo apt-get -qq remove -y docker docker-engine docker.io containerd runc
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get -qq update
sudo apt-get -qq install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
echo "***************************************************************"
docker version
docker info
displayName: Upgrade Docker to latest
- template: cached.yml
parameters:
name: publish_docker
# VERSION.txt is included to refresh Docker images for release
key: "ci/Dockerfile-envoy | VERSION.txt"
version: "$(cacheKeyDockerBuild)"
path: ""
- bash: |
echo "disk space at beginning of build:"
df -h
displayName: "Check disk space at beginning"
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "bazel.release"
itemPattern: "bazel.release/bin/*"
targetPath: $(Build.StagingDirectory)
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "bazel.release.arm64"
itemPattern: "bazel.release.arm64/bin/*"
targetPath: $(Build.StagingDirectory)
- bash: |
set -e
mkdir -p linux/amd64 linux/arm64
# x64
cp -a $(Build.StagingDirectory)/bazel.release/bin/release.tar.zst linux/amd64/release.tar.zst
cp -a $(Build.StagingDirectory)/bazel.release/bin/schema_validator_tool linux/amd64/schema_validator_tool
# arm64
cp -a $(Build.StagingDirectory)/bazel.release.arm64/bin/release.tar.zst linux/arm64/release.tar.zst
cp -a $(Build.StagingDirectory)/bazel.release.arm64/bin/schema_validator_tool linux/arm64/schema_validator_tool
# Debug what files appear to have been downloaded
find linux -type f -name "*" | xargs ls -l
ci/docker_ci.sh
timeoutInMinutes: ${{ parameters.timeoutDockerPublish }}
workingDirectory: $(Build.SourcesDirectory)
env:
AZP_BRANCH: $(Build.SourceBranch)
AZP_SHA1: $(Build.SourceVersion)
DOCKERHUB_USERNAME: $(DockerUsername)
DOCKERHUB_PASSWORD: $(DockerPassword)
- bash: |
echo "disk space at end of build:"
df -h
displayName: "Check disk space at end"
condition: always()
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: "$(Build.StagingDirectory)/build_images"
artifactName: docker
timeoutInMinutes: 10
condition: always()
- script: sudo .azure-pipelines/docker/save_cache.sh /mnt/docker_cache
displayName: "Cache/save (publish_docker)"
- job: package_x64
displayName: Linux debs (x64)
dependsOn: []
condition: and(not(canceled()), succeeded(), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.examplesOnly'], 'true'))
timeoutInMinutes: 120
pool:
vmImage: "ubuntu-20.04"
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "bazel.release"
itemPattern: "bazel.release/bin/*"
targetPath: $(Build.StagingDirectory)
- template: bazel.yml
parameters:
ciTarget: bazel.distribution
- job: package_arm64
displayName: Linux debs (arm64)
dependsOn: []
condition: and(not(canceled()), succeeded(), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.examplesOnly'], 'true'))
timeoutInMinutes: 120
pool: "envoy-arm-large"
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "bazel.release.arm64"
itemPattern: "bazel.release.arm64/bin/*"
targetPath: $(Build.StagingDirectory)
- template: bazel.yml
parameters:
managedAgent: false
ciTarget: bazel.distribution
rbe: false
artifactSuffix: ".arm64"
bazelBuildExtraOptions: "--sandbox_base=/tmp/sandbox_base"
- job: success
dependsOn: ["docker", "package_x64", "package_arm64"]
displayName: Success (linux artefacts)
pool:
vmImage: "ubuntu-20.04"
# This condition ensures that this (required) check passes if all of
# the preceding checks either pass or are skipped
# adapted from:
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#job-to-job-dependencies-within-one-stage
condition: |
and(
in(dependencies.docker.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.package_x64.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.package_arm64.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'))
steps:
- checkout: none
- bash: |
echo "building publishable assets complete"
- job: docs
displayName: Publish docs to netlify
dependsOn: ["success"]
condition: and(succeeded(), eq(variables['PostSubmit'], true), ne(variables['NoSync'], true))
pool:
vmImage: "ubuntu-20.04"
steps:
- task: Cache@2
inputs:
key: 'docs | $(cacheKeyBazelFiles)'
path: $(Build.StagingDirectory)/repository_cache
continueOnError: true
- script: ci/run_envoy_docker.sh 'ci/do_ci.sh docs'
workingDirectory: $(Build.SourcesDirectory)
env:
ENVOY_RBE: "true"
BAZEL_BUILD_EXTRA_OPTIONS: "--config=remote-ci --jobs=$(RbeJobs)"
AZP_BRANCH: $(Build.SourceBranch)
ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory)
BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com
BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
displayName: "Generate docs"
- script: |
bazel run //tools/distribution:update_dockerhub_repository
displayName: "Publish Dockerhub description and README"
env:
DOCKERHUB_USERNAME: $(DockerUsername)
DOCKERHUB_PASSWORD: $(DockerPassword)
condition: and(eq(variables['isMain'], 'true'), eq(variables['PostSubmit'], true))
- script: |
ci/run_envoy_docker.sh 'ci/upload_gcs_artifact.sh /source/generated/docs docs'
displayName: "Upload Docs to GCS"
env:
ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory)
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
GCS_ARTIFACT_BUCKET: $(GcsArtifactBucket)
condition: eq(variables['isMain'], 'true')
- task: InstallSSHKey@0
inputs:
hostName: "github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk="
sshPublicKey: "$(DocsPublicKey)"
sshPassphrase: "$(SshDeployKeyPassphrase)"
sshKeySecureFile: "$(DocsPrivateKey)"
- script: docs/publish.sh
displayName: "Publish to GitHub"
workingDirectory: $(Build.SourcesDirectory)
env:
AZP_BRANCH: $(Build.SourceBranch)
NETLIFY_TRIGGER_URL: $(NetlifyTriggerURL)
- job: github
displayName: Publish release tag
dependsOn: ["docs"]
condition: and(succeeded(), eq(variables['PostSubmit'], true), ne(variables['NoSync'], true), eq(variables['isStableBranch'], 'true'), eq(stageDependencies.env.repo.outputs['state.isDev'], 'false'))
pool:
vmImage: "ubuntu-20.04"
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "bazel.release"
itemPattern: "bazel.release/bin/*"
targetPath: $(Build.StagingDirectory)
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "bazel.release.arm64"
itemPattern: "bazel.release.arm64/bin/*"
targetPath: $(Build.StagingDirectory)
- task: DownloadSecureFile@1
name: MaintainerGPGKey
displayName: 'Download maintainer GPG key'
inputs:
# NB: This is the path to the key and **must** be set on a per-pipeline basis
secureFile: '$(maintainerGPGKey)'
- script: ./ci/run_envoy_docker.sh './ci/do_ci.sh publish'
displayName: "Publish release to Github"
workingDirectory: $(Build.SourcesDirectory)
env:
AZP_BRANCH: $(Build.SourceBranch)
GITHUB_TOKEN: $(GitHubPublicRepoOnlyAccessToken)
# TODO(phlax): combine this with publish step
- bash: |
set -e
VERSION="$(cat VERSION.txt)"
mkdir -p linux/amd64 linux/arm64 publish
# linux/amd64
tar xf $(Build.StagingDirectory)/bazel.release/release.tar.zst -C ./linux/amd64
cp -a linux/amd64/envoy "publish/envoy-${VERSION}-linux-x86_64"
cp -a linux/amd64/envoy-contrib "publish/envoy-contrib-${VERSION}-linux-x86_64"
# linux/arm64
tar xf $(Build.StagingDirectory)/bazel.release.arm64/release.tar.zst -C ./linux/arm64
cp -a linux/arm64/envoy "publish/envoy-${VERSION}-linux-aarch_64"
cp -a linux/arm64/envoy-contrib "publish/envoy-contrib-${VERSION}-linux-aarch_64"
echo "$MAINTAINER_GPG_KEY_PASSPHRASE" | gpg --batch --yes --passphrase-fd 0 --import "$(MaintainerGPGKey.secureFilePath)"
ci/publish_github_assets.sh "v${VERSION}" "${PWD}/publish"
workingDirectory: $(Build.SourcesDirectory)
env:
GITHUB_TOKEN: $(GitHubPublicRepoOnlyAccessToken)
MAINTAINER_GPG_KEY_PASSPHRASE: $(MaintainerGPGKeyPassphrase)
- stage: verify
displayName: Verify
dependsOn: ["env", "publish"]
jobs:
- job: examples
displayName: Examples (Docker/x64)
condition: and(not(canceled()), succeeded(), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'))
pool:
vmImage: "ubuntu-20.04"
steps:
- bash: .azure-pipelines/cleanup.sh
displayName: "Removing tools from agent"
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "docker"
itemPattern: "docker/envoy*.tar"
targetPath: $(Build.StagingDirectory)
- bash: ./ci/do_ci.sh verify_examples
env:
ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory)
NO_BUILD_SETUP: 1
# ENVOY_EXAMPLES_DEBUG: 1
- job: packages_x64
displayName: Debs (x64)
condition: and(not(canceled()), succeeded(), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.examplesOnly'], 'true'))
timeoutInMinutes: 120
pool:
vmImage: "ubuntu-20.04"
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "bazel.distribution"
itemPattern: "bazel.distribution/packages.x64.tar.gz"
downloadType: single
targetPath: $(Build.StagingDirectory)
- script: ci/run_envoy_docker.sh 'ci/do_ci.sh verify_distro'
workingDirectory: $(Build.SourcesDirectory)
env:
AZP_BRANCH: $(Build.SourceBranch)
ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory)
ENVOY_DOCKER_IN_DOCKER: 1
BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com
BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
displayName: "Verify packages"
- job: packages_arm64
displayName: Debs (arm64)
condition: and(not(canceled()), succeeded(), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.examplesOnly'], 'true'))
timeoutInMinutes: 120
pool: "envoy-arm-large"
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "bazel.distribution.arm64"
itemPattern: "bazel.distribution.arm64/packages.arm64.tar.gz"
downloadType: single
targetPath: $(Build.StagingDirectory)
- script: ci/run_envoy_docker.sh 'ci/do_ci.sh verify_distro'
workingDirectory: $(Build.SourcesDirectory)
env:
AZP_BRANCH: $(Build.SourceBranch)
ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory)
ENVOY_DOCKER_IN_DOCKER: 1
BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com
BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
displayName: "Verify packages"
- job: verified
displayName: Verification complete
dependsOn: ["examples", "packages_x64", "packages_arm64"]
pool:
vmImage: "ubuntu-20.04"
# This condition ensures that this (required) check passes if all of
# the preceding checks either pass or are skipped
# adapted from:
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#job-to-job-dependencies-within-one-stage
condition: |
and(
eq(variables['Build.Reason'], 'PullRequest'),
in(dependencies.examples.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.packages_x64.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.packages_arm64.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'))
steps:
- checkout: none
- bash: |
echo "checks complete"
- stage: macos
displayName: macOS
dependsOn: ${{ parameters.macBuildStageDeps }}
jobs:
- job: test
displayName: Build and test
condition: and(not(canceled()), succeeded(), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.examplesOnly'], 'true'))
timeoutInMinutes: 180
pool:
vmImage: "macos-11"
steps:
- script: ./ci/mac_ci_setup.sh
displayName: "Install dependencies"
- script: ./ci/mac_ci_steps.sh
displayName: "Run Mac CI"
env:
BAZEL_BUILD_EXTRA_OPTIONS: "--remote_download_toplevel --flaky_test_attempts=2"
BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com
BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
- task: PublishTestResults@2
inputs:
testResultsFiles: "**/bazel-testlogs/**/test.xml"
testRunTitle: "macOS"
timeoutInMinutes: 10
condition: always()
- job: tested
displayName: Complete
dependsOn: ["test"]
pool:
vmImage: "ubuntu-20.04"
# This condition ensures that this (required) job passes if all of
# the preceeding jobs either pass or are skipped
# adapted from:
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#job-to-job-dependencies-within-one-stage
condition: and(eq(variables['Build.Reason'], 'PullRequest'), in(dependencies.test.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'))
steps:
- checkout: none
- bash: |
echo "macos tested"
- stage: windows
displayName: Windows
dependsOn: ${{ parameters.windowsBuildStageDeps }}
jobs:
- job: release
displayName: Build and test
condition: and(not(canceled()), succeeded(), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.examplesOnly'], 'true'))
timeoutInMinutes: 180
pool:
vmImage: "windows-2019"
steps:
- task: Cache@2
inputs:
key: '"windows.release" | $(cacheKeyBazelFiles)'
path: $(Build.StagingDirectory)/repository_cache
continueOnError: true
- bash: ci/run_envoy_docker.sh ci/windows_ci_steps.sh
displayName: "Run Windows msvc-cl CI"
env:
CI_TARGET: "windows"
ENVOY_DOCKER_BUILD_DIR: "$(Build.StagingDirectory)"
SLACK_TOKEN: $(SLACK_TOKEN)
REPO_URI: $(Build.Repository.Uri)
BUILD_URI: $(Build.BuildUri)
ENVOY_RBE: "true"
BAZEL_BUILD_EXTRA_OPTIONS: "--config=remote-ci --config=remote-msvc-cl --jobs=$(RbeJobs) --flaky_test_attempts=2"
BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com
BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
- task: PublishTestResults@2
inputs:
testResultsFiles: "**/bazel-out/**/testlogs/**/test.xml"
testRunTitle: "windows"
searchFolder: $(Build.StagingDirectory)/tmp
timeoutInMinutes: 10
condition: always()
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: "$(Build.StagingDirectory)/envoy"
artifactName: windows.release
timeoutInMinutes: 10
condition: always()
- job: docker
displayName: Build Docker image
condition: and(not(canceled()), succeeded(), ne(stageDependencies.env.repo.outputs['changed.mobileOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.docsOnly'], 'true'), ne(stageDependencies.env.repo.outputs['changed.examplesOnly'], 'true'))
strategy:
matrix:
windows2019:
imageName: 'windows-2019'
windowsBuildType: "windows"
windowsImageBase: "mcr.microsoft.com/windows/servercore"
windowsImageTag: "ltsc2019"
windows2022:
imageName: 'windows-2022'
windowsBuildType: "windows-ltsc2022"
windowsImageBase: "mcr.microsoft.com/windows/nanoserver"
windowsImageTag: "ltsc2022"
dependsOn: ["release"]
timeoutInMinutes: 120
pool:
vmImage: $(imageName)
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "windows.release"
itemPattern: "windows.release/envoy_binary.tar.gz"
downloadType: single
targetPath: $(Build.StagingDirectory)
- bash: |
set -e
# Convert to Unix-style path so tar doesn't think drive letter is a hostname
STAGING_DIR="/$(echo '$(Build.StagingDirectory)' | tr -d ':' | tr '\\' '/')"
mkdir -p windows/amd64 && tar zxf "${STAGING_DIR}/windows.release/envoy_binary.tar.gz" -C ./windows/amd64
ci/docker_ci.sh
workingDirectory: $(Build.SourcesDirectory)
env:
AZP_BRANCH: $(Build.SourceBranch)
AZP_SHA1: $(Build.SourceVersion)
DOCKERHUB_USERNAME: $(DockerUsername)
DOCKERHUB_PASSWORD: $(DockerPassword)
WINDOWS_BUILD_TYPE: $(windowsBuildType)
WINDOWS_IMAGE_BASE: $(windowsImageBase)
WINDOWS_IMAGE_TAG: $(windowsImageTag)
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: "$(Build.StagingDirectory)/build_images"
artifactName: docker_windows
timeoutInMinutes: 10
condition: always()
- job: released
displayName: Complete
dependsOn: ["release", "docker"]
pool:
vmImage: "ubuntu-20.04"
# This condition ensures that this (required) job passes if all of
# the preceeding jobs either pass or are skipped
# adapted from:
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#job-to-job-dependencies-within-one-stage
condition: |
and(
eq(variables['Build.Reason'], 'PullRequest'),
in(dependencies.release.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.docker.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'))
steps:
- checkout: none
- bash: |
echo "windows released"