forked from Azure/azure-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
652 lines (478 loc) · 15.9 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
resources:
- repo: self
trigger:
batch: true
branches:
include:
- master
- dev
- release
jobs:
- job: ExtractMetadata
displayName: Extract Metadata
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: Bash@3
displayName: 'Extract Version'
inputs:
targetType: 'filePath'
filePath: scripts/release/get_version.sh
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: metadata'
inputs:
ArtifactName: metadata
- job: BuildWindowsMSI
displayName: Build Windows MSI
dependsOn: ExtractMetadata
condition: succeeded()
pool:
vmImage: 'vs2017-win2016'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: metadata
- script: |
set /p CLI_VERSION=<$(System.ArtifactsDirectory)/metadata/version
set
build_scripts/windows/scripts/build.cmd
displayName: 'Build Windows MSI'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: MSI'
inputs:
PathtoPublish: 'build_scripts/windows/out/'
ArtifactName: msi
- job: BuildDockerImage
displayName: Build Docker Image
dependsOn: ExtractMetadata
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: Bash@3
displayName: 'Bash Script'
inputs:
targetType: 'filePath'
filePath: scripts/release/docker/pipeline.sh
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: docker image'
inputs:
ArtifactName: docker
- job: TestDockerImage
displayName: Test Docker Image
dependsOn: BuildDockerImage
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Metadata'
inputs:
artifactName: metadata
- task: DownloadBuildArtifacts@0
displayName: 'Download Docker Image'
inputs:
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-16.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.7'
inputs:
versionSpec: 3.7
- task: Bash@3
displayName: 'Run Wheel Build Script'
inputs:
targetType: 'filePath'
filePath: scripts/release/pypi/build.sh
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: pypi'
inputs:
ArtifactName: pypi
- job: TestPythonWheel
displayName: Test Python Wheels
dependsOn: BuildPythonWheel
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Metadata'
inputs:
artifactName: metadata
- task: DownloadBuildArtifacts@0
displayName: 'Download PyPI Packages'
inputs:
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 2.7 =="
docker run \
--rm -v $PYPI_FILES:/mnt/pypi python:2.7 \
/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: BuildHomebrewFormula
displayName: Build Homebrew Formula
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Metadata'
inputs:
artifactName: metadata
- task: DownloadBuildArtifacts@0
displayName: 'Download PyPI Packages'
inputs:
artifactName: pypi
- 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)
pypi_files=$(cd $BUILD_ARTIFACTSTAGINGDIRECTORY/pypi; pwd)
echo "Generating formula in docker container ... "
docker run -v $docker_files:/mnt/scripts \
-v $pypi_files:/mnt/pypi \
-e CLI_VERSION=$CLI_VERSION \
-e HOMEBREW_UPSTREAM_URL=$HOMEBREW_UPSTREAM_URL \
--name azurecli \
python:3.6 \
/mnt/scripts/run.sh
# clean up
rm -rf $BUILD_ARTIFACTSTAGINGDIRECTORY/metadata
rm -rf $BUILD_ARTIFACTSTAGINGDIRECTORY/pypi
docker cp azurecli:azure-cli.rb $BUILD_ARTIFACTSTAGINGDIRECTORY/azure-cli.rb
docker rm --force azurecli
displayName: 'Build homebrew formula'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: homebrew'
inputs:
ArtifactName: homebrew
- job: TestHomebrewFormula
displayName: Test Homebrew Formula
dependsOn: BuildHomebrewFormula
condition: succeeded()
pool:
vmImage: 'macOS-10.13'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Metadata'
inputs:
artifactName: metadata
- task: DownloadBuildArtifacts@0
displayName: 'Download Homebrew'
inputs:
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
echo == Audit azure-cli.rb formula ==
brew audit --strict $SYSTEM_ARTIFACTSDIRECTORY/homebrew/azure-cli.rb
displayName: 'Bash Script'
- job: BuildYumPackage
displayName: Build Yum Package
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: Bash@3
displayName: 'Build Rpm Package'
inputs:
targetType: 'filePath'
filePath: scripts/release/rpm/pipeline.sh
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: yum'
inputs:
ArtifactName: yum
- job: TestYumPackage
displayName: Test Yum Package
dependsOn: BuildYumPackage
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Metadata'
inputs:
artifactName: metadata
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
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
docker run --rm -v $SYSTEM_ARTIFACTSDIRECTORY/yum:/mnt/yum centos /bin/bash -c "yum --nogpgcheck localinstall /mnt/yum/$YUM_NAME -y && time az self-test && time az --version && sleep 5"
displayName: 'Bash Script'
- job: BuildUbuntuXenial
displayName: Build Ubuntu Xenial Package
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: pypi
- task: Bash@3
displayName: 'Build Ubuntu Xenial Package'
inputs:
targetType: 'filePath'
filePath: scripts/release/debian/pipeline.sh
env:
DISTRO: xenial
DISTRO_BASE_IMAGE: ubuntu:xenial
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: debian'
inputs:
ArtifactName: debian
- job: BuildUbuntuArtful
displayName: Build Ubuntu Artful Package
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: pypi
- task: Bash@3
displayName: 'Build Ubuntu Artful Package'
inputs:
targetType: 'filePath'
filePath: scripts/release/debian/pipeline.sh
env:
DISTRO: artful
DISTRO_BASE_IMAGE: ubuntu:artful
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: debian'
inputs:
ArtifactName: debian
- job: BuildUbuntuTrusty
displayName: Build Ubuntu Trusty Package
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: pypi
- task: Bash@3
displayName: 'Build Ubuntu Trusty Package'
inputs:
targetType: 'filePath'
filePath: scripts/release/debian/pipeline.sh
env:
DISTRO: trusty
DISTRO_BASE_IMAGE: ubuntu:trusty
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: debian'
inputs:
ArtifactName: debian
- job: BuildUbuntuBionic
displayName: Build Ubuntu Bionic Package
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: pypi
- task: Bash@3
displayName: 'Build Ubuntu Bionic Package'
inputs:
targetType: 'filePath'
filePath: scripts/release/debian/pipeline.sh
env:
DISTRO: bionic
DISTRO_BASE_IMAGE: ubuntu:bionic
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: debian'
inputs:
ArtifactName: debian
- job: BuildDebianWheezy
displayName: Build Debian Wheezy Package
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: pypi
- task: Bash@3
displayName: 'Build Debian Wheezy'
inputs:
targetType: 'filePath'
filePath: scripts/release/debian/pipeline.sh
env:
DISTRO: wheezy
DISTRO_BASE_IMAGE: debian:wheezy
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: debian'
inputs:
ArtifactName: debian
- job: BuildDebianJessie
displayName: Build Debian Jessie Package
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: pypi
- task: Bash@3
displayName: 'Build Debian Jessie Package'
inputs:
targetType: 'filePath'
filePath: scripts/release/debian/pipeline.sh
env:
DISTRO: jessie
DISTRO_BASE_IMAGE: debian:jessie
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: debian'
inputs:
ArtifactName: debian
- job: BuildDebianStretch
displayName: Build Debian Stretch Package
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: pypi
- task: Bash@3
displayName: 'Build Debian Stretch Package'
inputs:
targetType: 'filePath'
filePath: scripts/release/debian/pipeline.sh
env:
DISTRO: stretch
DISTRO_BASE_IMAGE: debian:stretch
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: debian'
inputs:
ArtifactName: debian
- job: TestLinuxPackages
displayName: Test Linux Packages
dependsOn:
- BuildUbuntuXenial
- BuildUbuntuArtful
- BuildUbuntuTrusty
- BuildUbuntuBionic
- BuildDebianWheezy
- BuildDebianJessie
- BuildDebianStretch
- BuildUbuntuCosmic
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Metadata'
inputs:
artifactName: metadata
- task: DownloadBuildArtifacts@0
displayName: 'Download Debian Builds'
inputs:
artifactName: debian
- bash: |
set -exv
CLI_VERSION=`cat $SYSTEM_ARTIFACTSDIRECTORY/metadata/version`
DISTROS=(wheezy jessie stretch artful xenial trusty)
BASE_IMAGES=(debian:wheezy debian:jessie debian:stretch ubuntu:artful ubuntu:xenial ubuntu:trusty)
# Distros that don't require libssl1.1
for i in ${!DISTROS[@]}; do
echo "== Test debian package on ${DISTROS[$i]} =="
DEB_FILE=$SYSTEM_ARTIFACTSDIRECTORY/debian/azure-cli_$CLI_VERSION-1~${DISTROS[$i]}_all.deb
docker pull ${BASE_IMAGES[$i]}
docker run --rm -v $SYSTEM_ARTIFACTSDIRECTORY/debian:/mnt/artifacts ${BASE_IMAGES[$i]} /bin/bash -c "apt-get update && apt-get install -y apt-transport-https && dpkg -i /mnt/artifacts/azure-cli_$CLI_VERSION-1~${DISTROS[$i]}_all.deb && time az self-test && time az --version && sleep 5"
done
# Distros that do require libssl1.1
DISTROS=(bionic cosmic)
BASE_IMAGES=(ubuntu:bionic ubuntu:cosmic)
for i in ${!DISTROS[@]}; do
echo "== Test debian package on ${DISTROS[$i]} =="
DEB_FILE=$SYSTEM_ARTIFACTSDIRECTORY/debian/azure-cli_$CLI_VERSION-1~${DISTROS[$i]}_all.deb
docker pull ${BASE_IMAGES[$i]}
docker run --rm -v $SYSTEM_ARTIFACTSDIRECTORY/debian:/mnt/artifacts ${BASE_IMAGES[$i]} /bin/bash -c "apt-get update && apt-get install -y libssl1.1 apt-transport-https && dpkg -i /mnt/artifacts/azure-cli_$CLI_VERSION-1~${DISTROS[$i]}_all.deb && time az self-test && time az --version && sleep 5"
done
displayName: 'Bash Script'
- job: BuildUbuntuCosmic
displayName: Build Ubuntu Cosmic
dependsOn: BuildPythonWheel
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: pypi
- task: Bash@3
displayName: 'Bash Script'
inputs:
targetType: 'filePath'
filePath: scripts/release/debian/pipeline.sh
env:
DISTRO: cosmic
DISTRO_BASE_IMAGE: ubuntu:cosmic
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: debian'
inputs:
ArtifactName: debian