forked from Azure/azure-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
914 lines (776 loc) · 25.1 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
resources:
- repo: self
trigger:
batch: true
branches:
include:
- '*'
pr:
branches:
include:
- '*'
jobs:
- job: CheckPullRequestTitle
displayName: "Check the Format of Pull Request Title"
condition: and(succeeded(), in(variables['System.PullRequest.TargetBranch'], 'dev', 'release'))
pool:
vmImage: 'ubuntu-20.04'
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')
if [ "$(System.PullRequest.TargetBranch)" != "release" ] && echo $title | grep -iqF hotfix:; then
echo "Hotfix PR should target release branch."
exit 1
fi
[[ $title =~ ^(\[.*\]|\{.*\}).* ]] && exit 0
echo "Pull Request title should follow https://aka.ms/submitAzPR"
exit 1
- job: RejectPullRequestToMasterBranch
displayName: "Reject Pull Request To Master Branch"
condition: and(succeeded(), eq(variables['System.PullRequest.TargetBranch'], 'master'))
pool:
vmImage: 'ubuntu-20.04'
steps:
- bash: |
echo "Reject pull request directly to master branch"
exit 1
- job: CredScan
displayName: "Credential Scan"
pool:
vmImage: "windows-2019"
steps:
- task: ms-codeanalysis.vss-microsoft-security-code-analysis-devops.build-task-credscan.CredScan@2
displayName: 'Run Credential Scanner'
inputs:
toolMajorVersion: V2
suppressionsFile: './scripts/ci/credscan/CredScanSuppressions.json'
- task: ms-codeanalysis.vss-microsoft-security-code-analysis-devops.build-task-postanalysis.PostAnalysis@1
displayName: 'Post Analysis'
inputs:
AllTools: false
BinSkim: false
CredScan: true
RoslynAnalyzers: false
TSLint: false
ToolLogsNotFoundAction: 'Standard'
- job: ExtractMetadata
displayName: Extract Metadata
condition: succeeded()
pool:
vmImage: 'ubuntu-20.04'
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:
vmImage: 'ubuntu-20.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3'
inputs:
versionSpec: 3.x
- 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: 'macOS-10.15'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3'
inputs:
versionSpec: 3.x
- 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:
vmImage: 'vs2017-win2016'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3'
inputs:
versionSpec: 3.9
- 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:
vmImage: 'ubuntu-20.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.9'
inputs:
versionSpec: 3.9
- 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
dependsOn: ExtractMetadata
condition: succeeded()
pool:
vmImage: 'vs2017-win2016'
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- script: |
set /p CLI_VERSION=<$(System.ArtifactsDirectory)/metadata/version
set
build_scripts/windows/scripts/build.cmd
displayName: 'Build Windows MSI'
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: MSI'
inputs:
TargetPath: 'build_scripts/windows/out/'
ArtifactName: msi
- job: TestWindowsMSI
displayName: Test Windows MSI
dependsOn: BuildWindowsMSI
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
vmImage: 'vs2017-win2016'
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
- task: PowerShell@2
displayName: Install and Load CLI
inputs:
targetType: inline
script: |
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
# Start another Powershell process as Admin and execute this script again
$arguments = "& '" +$myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
# Stop if the PowerShell is not run as Admin
Break
}
# The following are executed by elevated PowerShell
az --version
$InstallArgs = @(
"/i"
"`"$env:SYSTEM_ARTIFACTSDIRECTORY\msi\Microsoft Azure CLI.msi`""
"/q"
"/norestart"
"/l*v"
".\install_logs.txt"
)
$pre_installed_version=az version --query '\"azure-cli\"' -o tsv
$to_be_installed_version=Get-Content $(System.ArtifactsDirectory)/metadata/version
if ($pre_installed_version -eq $to_be_installed_version){
# See https://docs.microsoft.com/windows/win32/msi/reinstallmode about options of REINSTALLMODE
$reinstall_option="REINSTALL=ALL REINSTALLMODE=emus"
$InstallArgs += $reinstall_option
}
Start-Process "msiexec.exe" -ArgumentList $InstallArgs -Wait -NoNewWindow
$install_time=Measure-Command {Start-Process "msiexec.exe" -ArgumentList $InstallArgs -Wait -NoNewWindow} | select -expand TotalSeconds
$installed_version=az version --query '\"azure-cli\"' -o tsv
if ($installed_version -ne $to_be_installed_version){
echo "The MSI failed to install."
Exit 1
}
echo 'Install time(seconds):' $install_time
az --version
# Test bundled pip with extension installation
az extension add -n rdbms-connect
az self-test
Get-Content .\install_logs.txt
- job: BuildDockerImage
displayName: Build Docker Image
dependsOn: ExtractMetadata
condition: succeeded()
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: Bash@3
displayName: 'Bash Script'
inputs:
targetType: 'filePath'
filePath: scripts/release/docker/pipeline.sh
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: docker image'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: docker
- job: TestDockerImage
displayName: Test Docker Image
dependsOn: BuildDockerImage
condition: succeeded()
pool:
vmImage: 'ubuntu-20.04'
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: 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:
vmImage: 'ubuntu-20.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.9'
inputs:
versionSpec: 3.9
- 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: PublishPipelineArtifact@0
displayName: 'Publish Artifact: pypi'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: pypi
- job: TestPythonWheel
displayName: Test Python Wheels
dependsOn: BuildPythonWheel
condition: succeeded()
pool:
vmImage: 'ubuntu-20.04'
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
- bash: |
#!/usr/bin/env bash
# Verify the pip wheels
set -ex
CLI_VERSION=`cat $BUILD_ARTIFACTSTAGINGDIRECTORY/metadata/version`
PYPI_FILES=$(cd $BUILD_ARTIFACTSTAGINGDIRECTORY/pypi; pwd)
echo "== Testing pip install on Python 3.6 =="
docker run \
--rm -v $PYPI_FILES:/mnt/pypi python:3.6 \
/bin/bash -c "ls /mnt/pypi && pip install -f /mnt/pypi -q azure-cli==$CLI_VERSION.* && az self-test && az --version && sleep 5"
echo "== Testing pip install on Python 3.7 =="
docker run \
--rm -v $PYPI_FILES:/mnt/pypi python:3.7 \
/bin/bash -c "ls /mnt/pypi && pip install -f /mnt/pypi -q azure-cli==$CLI_VERSION.* && az self-test && az --version && sleep 5"
echo "== Testing pip install on Python 3.8 =="
docker run \
--rm -v $PYPI_FILES:/mnt/pypi python:3.8 \
/bin/bash -c "ls /mnt/pypi && pip install -f /mnt/pypi -q azure-cli==$CLI_VERSION.* && az self-test && az --version && sleep 5"
echo "== Testing pip install on Python 3.9 =="
docker run \
--rm -v $PYPI_FILES:/mnt/pypi python:3.9 \
/bin/bash -c "ls /mnt/pypi && pip install -f /mnt/pypi -q azure-cli==$CLI_VERSION.* && az self-test && az --version && sleep 5"
displayName: 'Test pip Install'
- job: TestCore
displayName: Unit Test for Core
timeoutInMinutes: 10
pool:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
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:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
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:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: pip install --upgrade pip wheel
displayName: 'Install pip and wheel'
- bash: ./scripts/ci/test_profile_integration.sh
displayName: 'Run Integration Test against Profiles'
- job: AutomationTest
displayName: Automation Test (Profile Latest)
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
steps:
- template: .azure-pipelines/templates/automation_test.yml
parameters:
pythonVersion: '$(python.version)'
profile: 'latest'
- job: AutomationTest20200901
displayName: Automation Test (Profile 2020-09-01)
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
steps:
- template: .azure-pipelines/templates/automation_test.yml
parameters:
pythonVersion: '$(python.version)'
profile: '2020-09-01-hybrid'
- job: AutomationTest20190301
displayName: Automation Test (Profile 2019-03-01)
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
steps:
- template: .azure-pipelines/templates/automation_test.yml
parameters:
pythonVersion: '$(python.version)'
profile: '2019-03-01-hybrid'
- job: AutomationTest20180301
displayName: Automation Test (Profile 2018-03-01)
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
steps:
- template: .azure-pipelines/templates/automation_test.yml
parameters:
pythonVersion: '$(python.version)'
profile: '2018-03-01-hybrid'
- job: TestExtensionsLoading
displayName: Test Extensions Loading
condition: succeeded()
timeoutInMinutes: 20
pool:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
Python38:
python.version: '3.8'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: pip install --upgrade pip wheel
displayName: 'Install pip and wheel'
- 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:
vmImage: 'ubuntu-20.04'
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 \
python:3.9 \
/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: PublishPipelineArtifact@0
displayName: 'Publish Artifact: homebrew'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: homebrew
- job: TestHomebrewFormula
displayName: Test Homebrew Formula
dependsOn: BuildHomebrewFormula
condition: succeeded()
pool:
vmImage: 'macOS-10.15'
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
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: 'macOS-10.15'
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: BuildYumPackage
displayName: Build Yum Package
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: Bash@3
displayName: 'Build Rpm Package'
inputs:
targetType: 'filePath'
filePath: scripts/release/rpm/pipeline.sh
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: yum'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: yum
- job: TestYumPackage
displayName: Test Yum Package
timeoutInMinutes: 120
dependsOn: BuildYumPackage
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
vmImage: 'ubuntu-20.04'
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)/yum'
artifactName: yum
- bash: |
set -ex
CLI_VERSION=`cat $SYSTEM_ARTIFACTSDIRECTORY/metadata/version`
YUM_NAME=azure-cli-$CLI_VERSION-1.el7.x86_64.rpm
YUM_FILE=$SYSTEM_ARTIFACTSDIRECTORY/yum/$YUM_NAME
echo "== Test yum package on CentOS =="
docker pull centos:centos8
docker run --rm -e YUM_NAME=$YUM_NAME -v $SYSTEM_ARTIFACTSDIRECTORY/yum:/mnt/yum -v $(pwd):/azure-cli centos:centos8 /bin/bash "/azure-cli/scripts/release/rpm/test_rpm_in_docker.sh"
displayName: 'Test Yum Package'
- job: BuildDebPackages
displayName: Build Deb Packages
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
Xenial:
deb_system: ubuntu
distro: xenial
Trusty:
deb_system: ubuntu
distro: trusty
Bionic:
deb_system: ubuntu
distro: bionic
Focal:
deb_system: ubuntu
distro: focal
Groovy:
deb_system: ubuntu
distro: groovy
Jessie:
deb_system: debian
distro: jessie
Stretch:
deb_system: debian
distro: stretch
Buster:
deb_system: debian
distro: buster
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/pypi'
artifactName: pypi
- task: Bash@3
displayName: 'Build $(deb_system) $(distro) Package'
inputs:
targetType: 'filePath'
filePath: scripts/release/debian/pipeline.sh
env:
DISTRO: $(distro)
DISTRO_BASE_IMAGE: $(deb_system):$(distro)
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: debian'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: $(deb_system)-$(distro)
- job: TestDebPackages
displayName: Test Deb Packages
dependsOn:
- BuildDebPackages
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
strategy:
matrix:
Focal:
deb_system: ubuntu
distro: focal
Buster:
deb_system: debian
distro: buster
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Metadata'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata
- task: DownloadPipelineArtifact@1
displayName: 'Download $(deb_system):$(distro) Build'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/debian'
artifactName: $(deb_system)-$(distro)
- task: Bash@3
displayName: 'Test $(deb_system) $(distro) Package'
env:
DISTRO: $(distro)
DISTRO_BASE_IMAGE: $(deb_system):$(distro)
inputs:
targetType: 'inline'
script: |
set -exv
CLI_VERSION=`cat $SYSTEM_ARTIFACTSDIRECTORY/metadata/version`
echo "== Test debian package on ${DISTRO} =="
docker pull ${DISTRO_BASE_IMAGE}
docker run --rm -e DISTRO=${DISTRO} -e CLI_VERSION=$CLI_VERSION -v $SYSTEM_ARTIFACTSDIRECTORY/debian:/mnt/artifacts -v $(pwd):/azure-cli ${DISTRO_BASE_IMAGE} /bin/bash "/azure-cli/scripts/release/debian/test_deb_in_docker.sh"
- job: CheckStyle
displayName: "Check CLI Style"
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.9'
inputs:
versionSpec: 3.9
- template: .azure-pipelines/templates/azdev_setup.yml
- bash: |
set -ev
. env/bin/activate
azdev style
- job: CheckHeaders
displayName: "Check License, History, and DocMap"
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.9'
inputs:
versionSpec: 3.9
- template: .azure-pipelines/templates/azdev_setup.yml
- bash: |
set -ev
. env/bin/activate
azdev verify license
azdev verify history
azdev verify document-map
- job: PerformanceCheck
displayName: "PerformanceCheck"
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- template: .azure-pipelines/templates/azdev_setup.yml
- bash: |
set -ev
. env/bin/activate
azdev perf load-times
displayName: "Load Performance"
# - bash: |
# set -ev
# . env/bin/activate
# azdev perf benchmark "version" "network vnet -h" "rest -h" "storage account"
# displayName: "Execution Performance"
- job: CheckLinter
displayName: "Check CLI Linter"
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.9'
inputs:
versionSpec: 3.9
- template: .azure-pipelines/templates/azdev_setup.yml
- bash: |
set -ev
. env/bin/activate
python scripts/ci/service_name.py
if [[ "$(System.PullRequest.TargetBranch)" != "" ]]; then
azdev linter --ci-exclusions --min-severity medium --repo=./ --src=HEAD --tgt=origin/$(System.PullRequest.TargetBranch)
else
azdev linter --ci-exclusions --min-severity medium
fi
- job: VerifySphinxDocumentGenerator
displayName: "Verify Sphinx Document Generator"
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.9'
inputs:
versionSpec: 3.9
- bash: pip install --upgrade pip wheel
displayName: "Install pip and wheel"
- bash: ./scripts/ci/test_ref_doc.sh
displayName: "Verify Sphinx Document Generator"