forked from Azure/azure-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
1190 lines (1045 loc) · 36.4 KB
/
azure-pipelines.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
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
resources:
- repo: self
trigger:
batch: true
branches:
include:
- '*'
exclude:
- 'release'
pr:
branches:
include:
- '*'
variables:
- template: ${{ variables.Pipeline.Workspace }}/.azure-pipelines/templates/variables.yml
- name: Codeql.Enabled
value: false
parameters:
- name: architectures
type: object
default:
- name: AMD64
value: amd64
pool: pool-ubuntu-2004-multi-core
- name: ARM64
value: arm64
pool: ubuntu-arm64-2004-pool
jobs:
- job: CheckPullRequest
displayName: "Check the Format of Pull Request Title and Content"
condition: and(succeeded(), in(variables['System.PullRequest.TargetBranch'], 'dev', 'release', 'main'))
pool:
name: ${{ variables.ubuntu_pool }}
steps:
- bash: |
echo "Check Title of Pull Request: #$(System.PullRequest.PullRequestNumber)"
title=$(curl https://api.github.com/repos/$(Build.Repository.Name)/pulls/$(System.PullRequest.PullRequestNumber) | jq -r '.title')
echo $title
body=$(curl https://api.github.com/repos/$(Build.Repository.Name)/pulls/$(System.PullRequest.PullRequestNumber) | jq -r '.body')
echo $body
if [ "$(System.PullRequest.TargetBranch)" != "release" ] && echo $title | grep -iqF hotfix:; then
echo "Hotfix PR should target release branch."
exit 1
fi
if [ "$(System.PullRequest.TargetBranch)" == "main" ]; then
echo "Feature PR should target dev branch."
exit 1
fi
python scripts/ci/check_pull_request.py "$title" "$body"
- job: RejectPullRequestToMasterBranch
displayName: "Reject Pull Request To Master Branch"
condition: and(succeeded(), eq(variables['System.PullRequest.TargetBranch'], 'master'))
pool:
name: ${{ variables.ubuntu_pool }}
steps:
- bash: |
echo "Reject pull request directly to master branch"
exit 1
- job: CredentialScanner
displayName: "Credential Scanner"
pool:
name: ${{ variables.windows_pool }}
steps:
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
displayName: 'Run Credential Scanner'
inputs:
toolVersion: '2.1.17'
suppressionsFile: './scripts/ci/credscan/CredScanSuppressions.json'
- task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2
displayName: 'Post Analysis'
inputs:
GdnBreakAllTools: false
GdnBreakGdnToolCredScan: true
GdnBreakGdnToolCredScanSeverity: Error
- job: PolicyCheck
displayName: "Policy Check"
pool:
name: ${{ variables.windows_pool }}
steps:
- task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@2
displayName: 'Run Policy Check'
inputs:
targetType: F
result: PoliCheckResult.xml
- task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2
displayName: 'Post Analysis'
inputs:
GdnBreakAllTools: false
GdnBreakGdnToolPoliCheck: true
GdnBreakGdnToolPoliCheckSeverity: Error
- job: ExtractMetadata
displayName: Extract Metadata
condition: succeeded()
pool:
name: ${{ variables.ubuntu_pool }}
steps:
- task: Bash@3
displayName: 'Extract Version'
inputs:
targetType: 'filePath'
filePath: scripts/release/get_version.sh
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: metadata'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: metadata
- job: VerifyLinuxRequirements
displayName: 'Verify src/azure-cli/requirements.*.Linux.txt'
condition: succeeded()
pool:
name: ${{ variables.ubuntu_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.12'
inputs:
versionSpec: 3.12
- bash: ./scripts/ci/dependency_check.sh
displayName: 'Verify src/azure-cli/requirements.py3.Linux.txt'
- job: VerifyDarwinRequirements
displayName: 'Verify src/azure-cli/requirements.*.Darwin.txt'
condition: succeeded()
pool:
vmImage: ${{ variables.macos_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.12'
inputs:
versionSpec: 3.12
- bash: ./scripts/ci/dependency_check.sh
displayName: 'Verify src/azure-cli/requirements.py3.Darwin.txt'
- job: VerifyWindowsRequirements
displayName: 'Verify src/azure-cli/requirements.*.Windows.txt'
condition: succeeded()
pool:
name: ${{ variables.windows_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.12'
inputs:
versionSpec: 3.12
- task: BatchScript@1
inputs:
filename: ./scripts/ci/dependency_check.bat
displayName: 'Verify src/azure-cli/requirements.py3.Windows.txt'
- job: VerifyVersions
displayName: Verify Command Module Versions
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/release'), eq(variables['System.PullRequest.TargetBranch'], 'release')))
pool:
name: ${{ variables.ubuntu_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.12'
inputs:
versionSpec: 3.12
- template: .azure-pipelines/templates/azdev_setup.yml
- bash: |
set -ev
. env/bin/activate
azdev verify history
displayName: 'Verify History'
- job: BuildWindowsMSI
displayName: Build Windows MSI
strategy:
matrix:
x86:
Platform: x86
x64:
Platform: x64
dependsOn: ExtractMetadata
condition: succeeded()
pool:
name: ${{ variables.windows_pool }}
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)
- script: |
set ARCH=$(Platform)
set TARGET=msi
set /p CLI_VERSION=<$(System.ArtifactsDirectory)/metadata/version
set
build_scripts/windows/scripts/build.cmd
displayName: 'Build Windows MSI'
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'SBOM'
inputs:
BuildDropPath: 'build_scripts/windows/out/'
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: MSI'
inputs:
TargetPath: 'build_scripts/windows/out/'
ArtifactName: msi-$(Platform)
- job: BuildWindowsZIP
displayName: Build Windows ZIP
strategy:
matrix:
x64:
Platform: x64
dependsOn: ExtractMetadata
condition: succeeded()
pool:
name: ${{ variables.windows_pool }}
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)
- script: |
set ARCH=$(Platform)
set TARGET=zip
set /p CLI_VERSION=<$(System.ArtifactsDirectory)/metadata/version
set
build_scripts/windows/scripts/build.cmd
displayName: 'Build Windows ZIP'
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'SBOM'
inputs:
BuildDropPath: 'build_scripts/windows/out/'
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: ZIP'
inputs:
TargetPath: 'build_scripts/windows/out/'
ArtifactName: zip-$(Platform)
- job: TestMsiInstallation
displayName: Test MSI Installation
strategy:
matrix:
x86:
Platform: x86
x64:
Platform: x64
dependsOn: BuildWindowsMSI
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
name: ${{ variables.windows_pool }}
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/msi'
artifactName: msi-$(Platform)
- task: PowerShell@2
displayName: Install and Load CLI
inputs:
filePath: build_scripts\windows\scripts\test_msi_installation.ps1
- job: TestZipInstallation
displayName: Test ZIP Installation
dependsOn: BuildWindowsZIP
strategy:
matrix:
x64:
Platform: x64
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
name: ${{ variables.windows_pool }}
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/zip'
artifactName: zip-$(Platform)
- task: PowerShell@2
displayName: Expand and Load CLI
inputs:
filePath: build_scripts\windows\scripts\test_zip_installation.ps1
- job: BuildDockerImageAzureLinux
displayName: Build Docker Image Azure Linux
dependsOn: BuildRpmPackagesAzureLinux
strategy:
matrix:
${{ each arch in parameters.architectures }}:
Mariner 2.0 ${{ arch.name }}:
pool: ${{ arch.pool }}
artifactName: docker-mariner2.0-${{ arch.value }}
dockerfile: azure-linux.dockerfile
packageArtifactName: rpm-mariner2.0-${{ arch.value }}
image: mcr.microsoft.com/cbl-mariner/base/core:2.0
Azure Linux 3.0 ${{ arch.name }}:
pool: ${{ arch.pool }}
artifactName: docker-azurelinux3.0-${{ arch.value }}
dockerfile: azure-linux.dockerfile
packageArtifactName: rpm-azurelinux3.0-${{ arch.value }}
image: mcr.microsoft.com/azurelinux/base/core:3.0
pool:
name: $(pool)
steps:
- bash: ./scripts/ci/install_docker.sh
displayName: Install Docker
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/docker'
artifactName: $(packageArtifactName)
- bash: |
set -ex
mkdir docker-temp
mv $(Build.ArtifactStagingDirectory)/docker/*.rpm ./docker-temp/azure-cli.rpm
bash scripts/release/docker/pipeline.sh
displayName: 'Build Docker'
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'SBOM'
inputs:
BuildDropPath: $(Build.ArtifactStagingDirectory)
DockerImagesToScan: 'clibuild$BUILD_BUILDNUMBER:latest'
- task: PublishPipelineArtifact@0
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: $(artifactName)
- job: TestDockerImageAzureLinux
displayName: Test Docker Image Azure Linux
dependsOn:
- BuildDockerImageAzureLinux
- ExtractMetadata
strategy:
matrix:
${{ each arch in parameters.architectures }}:
Mariner 2.0 ${{ arch.name }}:
pool: ${{ arch.pool }}
artifactName: docker-mariner2.0-${{ arch.value }}
Azure Linux 3.0 ${{ arch.name }}:
pool: ${{ arch.pool }}
artifactName: docker-azurelinux3.0-${{ arch.value }}
pool:
name: $(pool)
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Metadata'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- task: DownloadPipelineArtifact@1
displayName: 'Download Docker Image'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/docker'
artifactName: $(artifactName)
- bash: ./scripts/ci/install_docker.sh
displayName: Install Docker
- bash: |
set -exv
CLI_VERSION=`cat $SYSTEM_ARTIFACTSDIRECTORY/metadata/version`
IMAGE_NAME=clibuild$BUILD_BUILDNUMBER:latest
TAR_FILE=$SYSTEM_ARTIFACTSDIRECTORY/docker/docker-azure-cli-$CLI_VERSION.tar
echo "== Test docker image =="
docker load < $TAR_FILE
docker run $IMAGE_NAME /bin/bash -c "time az self-test && time az --version && sleep 5"
displayName: 'Bash Script'
- job: BuildPythonWheel
displayName: Build Python Wheels
dependsOn: ExtractMetadata
condition: succeeded()
pool:
name: ${{ variables.ubuntu_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.12'
inputs:
versionSpec: 3.12
- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)
- script: |
if [[ "$(Build.Reason)" == "PullRequest" ]]; then
branch=$(System.PullRequest.TargetBranch)
else
branch=$(Build.SourceBranchName)
fi
scripts/release/pypi/build.sh $branch
displayName: 'Run Wheel Build Script'
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'SBOM'
inputs:
BuildDropPath: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: pypi'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: pypi
- job: TestPythonWheel
displayName: Test Python Wheels
strategy:
matrix:
Python39:
python.version: '3.9'
Python312:
python.version: '3.12'
dependsOn: BuildPythonWheel
condition: succeeded()
pool:
name: ${{ variables.ubuntu_pool }}
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Metadata'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- task: DownloadPipelineArtifact@1
displayName: 'Download PyPI Packages'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/pypi'
artifactName: pypi
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: |
#!/usr/bin/env bash
set -ex
CLI_VERSION=`cat $BUILD_ARTIFACTSTAGINGDIRECTORY/metadata/version`
echo "== Testing pip install on $PYTHON_VERSION =="
cd $BUILD_ARTIFACTSTAGINGDIRECTORY/pypi
pip install --find-links ./ azure_cli-$CLI_VERSION*whl && az self-test && az --version && sleep 5
displayName: 'Test pip Install'
- job: TestCore
displayName: Unit Test for Core
timeoutInMinutes: 10
pool:
name: ${{ variables.ubuntu_pool }}
strategy:
matrix:
Python39:
python.version: '3.9'
Python312:
python.version: '3.12'
steps:
- template: .azure-pipelines/templates/automation_test.yml
parameters:
pythonVersion: '$(python.version)'
module: 'azure-cli-core'
- job: TestTelemetry
displayName: Unit Test for Telemetry
timeoutInMinutes: 10
pool:
name: ${{ variables.ubuntu_pool }}
strategy:
matrix:
Python39:
python.version: '3.9'
Python312:
python.version: '3.12'
steps:
- template: .azure-pipelines/templates/automation_test.yml
parameters:
pythonVersion: '$(python.version)'
module: 'azure-cli-telemetry'
- job: IntegrationTestAgainstProfiles
displayName: Integration Test against Profiles
dependsOn: BuildPythonWheel
condition: succeeded()
timeoutInMinutes: 20
pool:
name: ${{ variables.ubuntu_pool }}
strategy:
matrix:
Python39:
python.version: '3.9'
Python312:
python.version: '3.12'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: pip install --upgrade pip wheel setuptools
displayName: 'Install pip and wheel'
- bash: ./scripts/ci/test_profile_integration.sh
displayName: 'Run Integration Test against Profiles'
- job: TestExtensionsLoading
displayName: Test Extensions Loading
condition: succeeded()
timeoutInMinutes: 40
pool:
name: ${{ variables.ubuntu_pool }}
strategy:
matrix:
Python312:
python.version: '3.12'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: pip install --upgrade pip wheel setuptools
displayName: 'Install pip and wheel setuptools'
- bash: ./scripts/ci/test_extensions.sh
displayName: 'Load extensions'
- job: BuildHomebrewFormula
displayName: Build Homebrew Formula
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
name: ${{ variables.ubuntu_pool }}
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Metadata'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- bash: |
#!/bin/bash
root=$(cd $(dirname $0); pwd)
set -evx
CLI_VERSION=`cat $BUILD_ARTIFACTSTAGINGDIRECTORY/metadata/version`
HOMEBREW_UPSTREAM_URL=`curl -Ls -o /dev/null -w %{url_effective} https://api.github.com/repos/Azure/azure-cli/tarball/$BUILD_SOURCEVERSION`
docker_files=$(cd $BUILD_SOURCESDIRECTORY/scripts/release/homebrew/docker; pwd)
src_files=$(cd $BUILD_SOURCESDIRECTORY/src; pwd)
echo "Generating formula in docker container ... "
docker run -v $docker_files:/mnt/scripts \
-v $src_files:/mnt/src \
-e CLI_VERSION=$CLI_VERSION \
-e HOMEBREW_UPSTREAM_URL=$HOMEBREW_UPSTREAM_URL \
--name azurecli \
mcr.microsoft.com/azurelinux/base/python:3 \
/mnt/scripts/run.sh
# clean up
rm -rf $BUILD_ARTIFACTSTAGINGDIRECTORY/metadata
docker cp azurecli:azure-cli.rb $BUILD_ARTIFACTSTAGINGDIRECTORY/azure-cli.rb
docker rm --force azurecli
displayName: 'Build homebrew formula'
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'SBOM'
inputs:
BuildDropPath: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: homebrew'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: homebrew
- job: TestHomebrewFormula
displayName: Test Homebrew Formula
dependsOn: BuildHomebrewFormula
condition: succeeded()
pool:
vmImage: ${{ variables.macos_pool }}
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Metadata'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- task: DownloadPipelineArtifact@1
displayName: 'Download Homebrew'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/homebrew'
artifactName: homebrew
- bash: |
set -ev
# Force relink python@3.xx in Homebrew to resolve the conflict with pre-installed python 3.xx on macOS-12 image
# See: https://github.com/Azure/azure-cli/issues/29054
python_version=3.12
brew unlink python@$python_version && brew link --overwrite python@$python_version
echo == Remove pre-installed azure-cli ==
brew uninstall azure-cli
echo == Install azure-cli.rb formula ==
brew install --build-from-source $SYSTEM_ARTIFACTSDIRECTORY/homebrew/azure-cli.rb
echo == Az Version ==
az --version
echo == Run Self-Test ==
az self-test
displayName: 'Bash Script'
- job: TestHomebrewPackage
displayName: Test Homebrew Package
timeoutInMinutes: 180
dependsOn: BuildHomebrewFormula
# condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
condition: false
pool:
vmImage: ${{ variables.macos_pool }}
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Metadata'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/homebrew'
artifactName: homebrew
- bash: ./scripts/release/homebrew/test_homebrew_package.sh
displayName: 'Test Homebrew Package'
- job: BuildRpmPackagesAzureLinux
displayName: Build Rpm Package
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
strategy:
matrix:
${{ each arch in parameters.architectures }}:
Mariner 2.0 ${{ arch.name }}:
image: mcr.microsoft.com/cbl-mariner/base/core:2.0
artifact: rpm-mariner2.0-${{ arch.value }}
pool: ${{ arch.pool }}
Azure Linux 3.0 ${{ arch.name }}:
image: mcr.microsoft.com/azurelinux/base/core:3.0
artifact: rpm-azurelinux3.0-${{ arch.value }}
pool: ${{ arch.pool }}
pool:
name: $(pool)
steps:
- bash: ./scripts/ci/install_docker.sh
displayName: Install Docker
- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)
- task: Bash@3
displayName: 'Build Rpm Package: Azure Linux'
inputs:
targetType: 'filePath'
filePath: scripts/release/rpm/pipeline_azurelinux.sh
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'SBOM'
inputs:
BuildDropPath: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: rpm-mariner'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: $(artifact)
- job: TestRpmPackagesAzureLinux
displayName: Test Rpm Package
timeoutInMinutes: 180
dependsOn:
- BuildRpmPackagesAzureLinux
- ExtractMetadata
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
name: $(pool)
strategy:
matrix:
${{ each arch in parameters.architectures }}:
Mariner 2.0 ${{ arch.name }}:
image: mcr.microsoft.com/cbl-mariner/base/core:2.0
artifact: rpm-mariner2.0-${{ arch.value }}
pool: ${{ arch.pool }}
Azure Linux 3.0 ${{ arch.name }}:
image: mcr.microsoft.com/azurelinux/base/core:3.0
artifact: rpm-azurelinux3.0-${{ arch.value }}
pool: ${{ arch.pool }}
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Metadata'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/rpm'
artifactName: $(artifact)
- bash: ./scripts/ci/install_docker.sh
displayName: Install Docker
- bash: |
set -ex
CLI_VERSION=`cat $SYSTEM_ARTIFACTSDIRECTORY/metadata/version`
RPM_NAME=$(find $SYSTEM_ARTIFACTSDIRECTORY/rpm/ -type f -name "azure-cli-$CLI_VERSION-1.*.rpm" -printf '%f\n')
echo "== Test rpm package on ${IMAGE} =="
docker pull $IMAGE
docker run --rm -e RPM_NAME=$RPM_NAME -v $SYSTEM_ARTIFACTSDIRECTORY/rpm:/mnt/rpm -v $(pwd):/azure-cli $IMAGE /bin/bash "/azure-cli/scripts/release/rpm/test_azurelinux_in_docker.sh"
displayName: 'Test Rpm Package Mariner'
# TODO: rpmbuild on Red Hat UBI 8 is slow for unknown reason. Still working with Red Hat to investigate.
- job: BuildRpmPackages
displayName: Build Rpm Packages
# Do not run this job for Pull Requests due to the slowness
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
name: $(pool)
strategy:
matrix:
${{ each arch in parameters.architectures }}:
Red Hat Universal Base Image 8 ${{ arch.name }}:
dockerfile: ubi
image: registry.access.redhat.com/ubi8/ubi:8.4
artifact: rpm-ubi8-${{ arch.value }}
python_package: python39
pool: ${{ arch.pool }}
Red Hat Universal Base Image 9 ${{ arch.name }}:
dockerfile: ubi
image: registry.access.redhat.com/ubi9/ubi:9.0.0
artifact: rpm-ubi9-${{ arch.value }}
python_package: python3.9
pool: ${{ arch.pool }}
steps:
- bash: ./scripts/ci/install_docker.sh
displayName: Install Docker
- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)
- task: Bash@3
displayName: 'Build Rpm Package'
inputs:
targetType: 'filePath'
filePath: scripts/release/rpm/pipeline.sh
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'SBOM'
inputs:
BuildDropPath: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: rpm'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: $(artifact)
- job: TestRpmPackage
displayName: Test Rpm Package
timeoutInMinutes: 180
dependsOn:
- BuildRpmPackages
- ExtractMetadata
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
name: $(pool)
strategy:
matrix:
${{ each arch in parameters.architectures }}:
Red Hat Universal Base Image 8 ${{ arch.name }}:
artifact: rpm-ubi8-${{ arch.value }}
distro: el8
image: registry.access.redhat.com/ubi8/ubi:8.4
python_package: python39
python_cmd: python3.9
pip_cmd: pip3.9
pool: ${{ arch.pool }}
Red Hat Universal Base Image 9 ${{ arch.name }}:
artifact: rpm-ubi9-${{ arch.value }}
distro: el9
image: registry.access.redhat.com/ubi9/ubi:9.0.0
python_package: python3.9
python_cmd: python3.9
pip_cmd: pip3.9
pool: ${{ arch.pool }}
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Metadata'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/rpm'
artifactName: $(artifact)
- bash: ./scripts/ci/install_docker.sh
displayName: Install Docker
- bash: |
set -ex
CLI_VERSION=`cat $SYSTEM_ARTIFACTSDIRECTORY/metadata/version`
RPM_NAME=$(find $SYSTEM_ARTIFACTSDIRECTORY/rpm/ -type f -name "azure-cli-$CLI_VERSION-1.${DISTRO}.*.rpm" -printf '%f\n')
echo "== Test rpm package on ${IMAGE} =="
docker pull $IMAGE
docker run --rm -e RPM_NAME=$RPM_NAME -e PYTHON_PACKAGE=${PYTHON_PACKAGE} -e PYTHON_CMD=${PYTHON_CMD} -e PIP_CMD=${PIP_CMD} -v $SYSTEM_ARTIFACTSDIRECTORY/rpm:/mnt/rpm -v $(pwd):/azure-cli $IMAGE /bin/bash "/azure-cli/scripts/release/rpm/test_rpm_in_docker.sh"
displayName: 'Test Rpm Package'
- job: BuildDebPackages
displayName: Build Deb Packages
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
name: $(pool)
strategy:
matrix:
${{ each arch in parameters.architectures }}:
# https://wiki.ubuntu.com/Releases
Focal ${{ arch.name }}:
# 20.04
deb_system: ubuntu
distro: focal
arch: ${{ arch.value }}
pool: ${{ arch.pool }}
Jammy ${{ arch.name }}:
# 22.04
deb_system: ubuntu
distro: jammy
arch: ${{ arch.value }}
pool: ${{ arch.pool }}
Noble ${{ arch.name }}:
# 24.04
deb_system: ubuntu
distro: noble
arch: ${{ arch.value }}
pool: ${{ arch.pool }}
# https://wiki.debian.org/DebianReleases
Bullseye ${{ arch.name }}:
# 11
deb_system: debian
distro: bullseye
arch: ${{ arch.value }}
pool: ${{ arch.pool }}
Bookworm ${{ arch.name }}:
# 12
deb_system: debian
distro: bookworm
arch: ${{ arch.value }}
pool: ${{ arch.pool }}
steps:
- bash: ./scripts/ci/install_docker.sh
displayName: Install Docker
- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)
- task: Bash@3
displayName: 'Build $(deb_system) $(distro) $(arch) Package'
inputs:
targetType: 'filePath'
filePath: scripts/release/debian/pipeline.sh
env:
DISTRO_BASE_IMAGE: mcr.microsoft.com/mirror/docker/library/$(deb_system):$(distro)
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'SBOM'
inputs:
BuildDropPath: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: $(deb_system) $(distro) $(arch)'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: $(deb_system)-$(distro)-$(arch)
- job: TestDebPackages
timeoutInMinutes: 180
displayName: Test Deb Packages
dependsOn:
- BuildDebPackages
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
strategy:
matrix:
${{ each arch in parameters.architectures }}:
Focal ${{ arch.name }}:
deb_system: ubuntu
distro: focal
arch: ${{ arch.value }}
pool: ${{ arch.pool }}
Jammy ${{ arch.name }}:
deb_system: ubuntu
distro: jammy
arch: ${{ arch.value }}
pool: ${{ arch.pool }}
Noble ${{ arch.name }}:
deb_system: ubuntu
distro: noble
arch: ${{ arch.value }}
pool: ${{ arch.pool }}
Bullseye ${{ arch.name }}:
deb_system: debian
distro: bullseye