forked from Azure/aztfexport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
721 lines (686 loc) · 26.7 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
parameters:
- name: version
displayName: Release Version (e.g. v0.1.0)
type: string
- name: artifactBuildId
displayName: "Artifact source build id (defaults uses this build)"
type: number
default: 0
variables:
- name: pipelineId
value: 22
stages:
- stage: build
pool:
name: pool-ubuntu-2004
displayName: "Build"
jobs:
- job: build
displayName: "Build Binaries"
strategy:
matrix:
windows-386:
OS: windows
ARCH: 386
windows-amd64:
OS: windows
ARCH: amd64
linux-386:
OS: linux
ARCH: 386
linux-amd64:
OS: linux
ARCH: amd64
linux-arm:
OS: linux
ARCH: arm
linux-arm64:
OS: linux
ARCH: arm64
darwin-amd64:
OS: darwin
ARCH: amd64
darwin-arm64:
OS: darwin
ARCH: arm64
steps:
- task: GoTool@0
displayName: "Install Go"
inputs:
version: 1.19
- script: |
set -e
REVISION=`git rev-parse --short HEAD`
mkdir build
name=aztfexport
if [[ $OS = windows ]]; then
name=aztfexport.exe
fi
GOOS="${OS}" GOARCH="${ARCH}" CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X 'main.version=${VERSION}' -X 'main.revision=${REVISION}'" -o build/$name
displayName: "Go Build"
env:
OS: $(OS)
ARCH: $(ARCH)
VERSION: ${{ parameters.version }}
- task: UseDotNet@2
displayName: 'Install .NET SDK (Windows Only)'
condition: eq(variables.OS, 'windows')
inputs:
packageType: 'sdk'
version: '3.x'
- task: EsrpCodeSigning@1
displayName: "Sign Binary (Windows Only)"
condition: eq(variables.OS, 'windows')
inputs:
ConnectedServiceName: "ESRP Signing Service"
FolderPath: "$(system.defaultWorkingDirectory)/build"
Pattern: "*.exe"
signConfigType: "inlineSignParams"
inlineOperation: |
[
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolSign",
"Parameters" : {
"OpusName" : "Microsoft",
"OpusInfo" : "http://www.microsoft.com",
"PageHash" : "/NPH",
"TimeStamp" : "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256",
"FileDigest": "/fd \"SHA256\""
},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
SessionTimeout: "60"
MaxConcurrency: "50"
MaxRetryAttempts: "5"
- task: PublishPipelineArtifact@1
displayName: "Publish Binary"
inputs:
targetPath: "$(system.defaultWorkingDirectory)/build"
artifactName: "$(OS)-$(ARCH)"
- job: build_windows_setup
displayName: "Build Windows Setup"
pool:
name: pool-windows-2019
dependsOn: build
strategy:
matrix:
386:
ARCH: 386
amd64:
ARCH: amd64
steps:
- task: DownloadPipelineArtifact@2
displayName: "Download binary"
inputs:
artifact: windows-$(ARCH)
path: $(system.defaultWorkingDirectory)/dist/bin
- task: DownloadPackage@1
displayName: "Download wix toolset"
inputs:
packageType: 'upack'
feed: '9b6b54d1-85ce-4ff5-8faa-608b4a183fc6/fe61ad7c-682d-4a30-ae2e-6891a3b27dde'
view: '2e6dbd24-c57a-430c-9148-c2cf257a62ae'
definition: 'a4999329-4b03-4635-bbf3-1ae2d2405efe'
version: '3.11.2'
downloadPath: $(system.defaultWorkingDirectory)/dist/tool
- bash: |
set -e
# Setup wix
./dist/tool/wix311.exe -install -quiet -norestart
export PATH=$PATH:"/c/Program Files (x86)/WiX Toolset v3.11/bin"
# Build
cd $workdir/scripts/package/windows/build
declare -A map=( [386]=x86 [amd64]=x64 )
export VERSION=${VERSION:1}
cp $workdir/dist/bin/aztfexport.exe .
candle.exe -arch ${map[$ARCH]} -o setup.wxobj ./setup.wxs
mkdir $workdir/dist/output
light.exe -out $workdir/dist/output/aztfexport.msi ./setup.wxobj
env:
workdir: $(system.defaultWorkingDirectory)
VERSION: ${{ parameters.version }}
ARCH: $(ARCH)
displayName: "Build"
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: '3.x'
- task: EsrpCodeSigning@1
displayName: "Sign MSI"
inputs:
ConnectedServiceName: "ESRP Signing Service"
FolderPath: "$(system.defaultWorkingDirectory)/dist/output"
Pattern: "*.msi"
signConfigType: "inlineSignParams"
inlineOperation: |
[
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolSign",
"Parameters" : {
"OpusName" : "Microsoft",
"OpusInfo" : "http://www.microsoft.com",
"PageHash" : "/NPH",
"TimeStamp" : "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256",
"FileDigest": "/fd \"SHA256\""
},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
SessionTimeout: "60"
MaxConcurrency: "50"
MaxRetryAttempts: "5"
- task: PublishPipelineArtifact@1
displayName: "Publish MSI"
inputs:
targetPath: "$(system.defaultWorkingDirectory)/dist/output"
artifactName: windows-$(ARCH)-msi
- job: build_linux_packages
displayName: "Build Linux RPM/Debian Packages"
dependsOn: build
strategy:
matrix:
linux-386:
OS: linux
ARCH: 386
linux-amd64:
OS: linux
ARCH: amd64
linux-arm:
OS: linux
ARCH: arm
linux-arm64:
OS: linux
ARCH: arm64
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: $(OS)-$(ARCH)
path: $(system.defaultWorkingDirectory)/dist/source
- script: |
mkdir $workdir/dist/output
displayName: "Prepare the output directory"
env:
workdir: $(system.defaultWorkingDirectory)
- script: |
set -e
chmod +x $WORKDIR/dist/source/aztfexport
declare -A deb_arch_map=( [386]=i386 [amd64]=amd64 [arm]=armhf [arm64]=arm64 )
declare -A rpm_arch_map=( [386]=i686 [amd64]=x86_64 [arm]=armv7hl [arm64]=aarch64 )
version=${VERSION:1}
# Build the image
cd $WORKDIR/scripts/package/linux/build
docker build -t aztfexportbuild .
# Build deb package
docker run -t --rm \
-v $WORKDIR/dist/source:/build/source \
-v $WORKDIR/dist/output:/build/output \
aztfexportbuild \
fpm \
--name aztfexport \
--license MPL-2.0 \
--version $version \
--description "A tool to bring existing Azure resources under Terraform's management" \
--url "https://github.com/Azure/aztfexport" \
--maintainer "magodo <[email protected]>" \
--input-type dir \
--output-type deb \
--architecture ${deb_arch_map[$ARCH]} \
--package /build/output/aztfexport-$version-1-${deb_arch_map[$ARCH]}.deb \
/build/source/aztfexport=/usr/bin/aztfexport
# Build rpm package
echo $version
docker run -t --rm \
-v $WORKDIR/dist/source:/build/source \
-v $WORKDIR/dist/output:/build/output \
aztfexportbuild \
fpm \
--name aztfexport \
--license MPL-2.0 \
--version ${version} \
--description "A tool to bring existing Azure resources under Terraform's management" \
--url "https://github.com/Azure/aztfexport" \
--maintainer "magodo <[email protected]>" \
--input-type dir \
--output-type rpm \
--architecture ${rpm_arch_map[$ARCH]} \
--package /build/output/aztfexport-$version-1-${rpm_arch_map[$ARCH]}.rpm \
/build/source/aztfexport=/usr/bin/aztfexport
displayName: "Build Packages"
env:
VERSION: ${{ parameters.version }}
WORKDIR: $(system.defaultWorkingDirectory)
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: '3.x'
- task: EsrpCodeSigning@1
displayName: "Sign Package"
inputs:
ConnectedServiceName: "ESRP Signing Service"
FolderPath: "$(system.defaultWorkingDirectory)/dist/output"
Pattern: "*.rpm,*.deb"
signConfigType: "inlineSignParams"
inlineOperation: |
[
{
"KeyCode": "CP-450779-Pgp",
"OperationCode": "LinuxSign",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
SessionTimeout: "60"
MaxConcurrency: "50"
MaxRetryAttempts: "5"
- task: PublishPipelineArtifact@1
displayName: "Publish Packages"
inputs:
targetPath: "$(system.defaultWorkingDirectory)/dist/output"
artifactName: $(OS)-$(ARCH)-pkg
- stage: github_release
displayName: "Github Draft Release"
pool:
name: pool-ubuntu-2004
jobs:
- job: release
displayName: "Github Release"
steps:
- ${{ if eq(parameters.artifactBuildId, 0) }}:
- task: DownloadPipelineArtifact@2
inputs:
path: $(system.defaultWorkingDirectory)/dist
- ${{ else }}:
- task: DownloadPipelineArtifact@2
inputs:
path: $(system.defaultWorkingDirectory)/dist
source: "specific"
project: "release"
pipeline: $(pipelineId)
runVersion: "specific"
runId: ${{ parameters.artifactBuildId }}
- script: |
set -e
NAME="aztfexport"
OS_ARCH=(
"windows:amd64"
"windows:386"
"linux:amd64"
"linux:386"
"linux:arm"
"linux:arm64"
"darwin:amd64"
"darwin:arm64"
)
mkdir release
for os_arch in "${OS_ARCH[@]}" ; do
OS=${os_arch%%:*}
ARCH=${os_arch#*:}
name=aztfexport
if [[ $OS = windows ]]; then
name=aztfexport.exe
fi
chmod +x dist/${OS}-${ARCH}/${name}
zip -j release/${NAME}_${VERSION}_${OS}_${ARCH}.zip dist/${OS}-${ARCH}/${name}
done
# Copy MSI
cp dist/windows-386-msi/aztfexport.msi release/${NAME}_${VERSION}_x86.msi
cp dist/windows-amd64-msi/aztfexport.msi release/${NAME}_${VERSION}_x64.msi
cd release
shasum -a 256 *.zip *.msi > ${NAME}_SHA256SUMS
cp ${NAME}_SHA256SUMS ${NAME}_SHA256SUMS.sig
displayName: "Prepare Binary Archives & Digests"
env:
VERSION: ${{ parameters.version }}
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: '3.x'
- task: EsrpCodeSigning@1
displayName: "Sign Binary Archive Digests"
inputs:
ConnectedServiceName: "ESRP Signing Service"
FolderPath: "$(system.defaultWorkingDirectory)/release"
Pattern: "*_SHA256SUMS.sig"
signConfigType: "inlineSignParams"
inlineOperation: |
[
{
"KeyCode": "CP-450779-Pgp",
"OperationCode": "LinuxSign",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
SessionTimeout: "60"
MaxConcurrency: "50"
MaxRetryAttempts: "5"
- script: |
set -e
git config user.name "azure-terraform-bot"
git config user.email "[email protected]"
git tag -a "${VERSION}" -m "${VERSION}"
git push https://${PAT}@github.com/Azure/aztfexport.git --tags
displayName: "Create and Push a Git Release"
env:
VERSION: ${{ parameters.version }}
PAT: $(AZURE_TERRAFORM_BOT_PAT)
- task: GitHubRelease@1
displayName: "Draft Github Release"
inputs:
gitHubConnection: "github_aztfy"
repositoryName: "$(Build.Repository.Name)"
action: "create"
target: "$(Build.SourceVersion)"
tagSource: "gitTag"
tagPattern: '^v\d+\.\d+\.\d+'
assets: "$(system.defaultWorkingDirectory)/release/*"
isDraft: true
addChangeLog: false
- stage: publish_linux_packages
displayName: "Publish Linux Packages"
pool:
name: pool-ubuntu-2004
jobs:
- job: publish
displayName: "Publish Packages"
strategy:
matrix:
# deb platforms
# ubuntu-bionic-amd64:
# TYPE: deb
# ARCH: amd64
# REPO_ID: 5d16326637164fbc1139c4e1
# REPO_DISTRO: ubuntu
# REPO_RELEASE: bionic
# ubuntu-bionic-arm64:
# TYPE: deb
# ARCH: arm64
# REPO_ID: 5d16326637164fbc1139c4e1
# REPO_DISTRO: ubuntu
# REPO_RELEASE: bionic
ubuntu-focal-amd64:
TYPE: deb
ARCH: amd64
REPO_ID: repositories-deb-apt-50a94aad-3f2d-414c-8792-c8914a994b60
REPO_DISTRO: ubuntu
REPO_RELEASE: focal
ubuntu-focal-arm64:
TYPE: deb
ARCH: arm64
REPO_ID: repositories-deb-apt-50a94aad-3f2d-414c-8792-c8914a994b60
REPO_DISTRO: ubuntu
REPO_RELEASE: focal
ubuntu-jammy-amd64:
TYPE: deb
ARCH: amd64
REPO_ID: repositories-deb-apt-ce5e32e0-a0e2-4e8d-b83b-e353a44ba19d
REPO_DISTRO: ubuntu
REPO_RELEASE: jammy
ubuntu-jammy-arm64:
TYPE: deb
ARCH: arm64
REPO_ID: repositories-deb-apt-ce5e32e0-a0e2-4e8d-b83b-e353a44ba19d
REPO_DISTRO: ubuntu
REPO_RELEASE: jammy
# debian-buster-amd64:
# TYPE: deb
# ARCH: amd64
# REPO_ID: 5d23b16c9a6e3b375bbba42e
# REPO_DISTRO: debian
# REPO_RELEASE: buster
# debian-buster-arm64:
# TYPE: deb
# ARCH: arm64
# REPO_ID: 5d23b16c9a6e3b375bbba42e
# REPO_DISTRO: debian
# REPO_RELEASE: buster
# debian-bullseye-amd64:
# TYPE: deb
# ARCH: amd64
# REPO_ID: 611ab3a32acdcd0744c8c841
# REPO_DISTRO: debian
# REPO_RELEASE: bullseye
# debian-bullseye-arm64:
# TYPE: deb
# ARCH: arm64
# REPO_ID: 611ab3a32acdcd0744c8c841
# REPO_DISTRO: debian
# REPO_RELEASE: bullseye
# rpm platforms
# centos-8-x86_64:
# TYPE: rpm
# ARCH: amd64
# REPO_ID: 5e5ed94a523a8019fe47607e
# REPO_DISTRO: centos
# REPO_RELEASE: 8
# centos-8-aarch64:
# TYPE: rpm
# ARCH: arm64
# REPO_ID: 5e5ed94a523a8019fe47607e
# REPO_DISTRO: centos
# REPO_RELEASE: 8
rhel-8-x86_64:
TYPE: rpm
ARCH: amd64
REPO_ID: repositories-rpm-rpm-825ad4f6-c3fb-48b0-8f61-acb58e2fff7c
REPO_DISTRO: rhel
REPO_RELEASE: 8
rhel-8-aarch64:
TYPE: rpm
ARCH: arm64
REPO_ID: repositories-rpm-rpm-825ad4f6-c3fb-48b0-8f61-acb58e2fff7c
REPO_DISTRO: rhel
REPO_RELEASE: 8
rhel-9-x86_64:
TYPE: rpm
ARCH: amd64
REPO_ID: repositories-rpm-rpm-f225b6b6-c414-4abb-a80d-5b8bdb8bc757
REPO_DISTRO: rhel
REPO_RELEASE: 9
rhel-9-aarch64:
TYPE: rpm
ARCH: arm64
REPO_ID: repositories-rpm-rpm-f225b6b6-c414-4abb-a80d-5b8bdb8bc757
REPO_DISTRO: rhel
REPO_RELEASE: 9
# fedora-34-x86_64:
# TYPE: rpm
# ARCH: amd64
# REPO_ID: 606e1da573e50659b0803a7b
# REPO_DISTRO: fedora
# REPO_RELEASE: 34
# fedora-34-aarch64:
# TYPE: rpm
# ARCH: arm64
# REPO_ID: 606e1da573e50659b0803a7b
# REPO_DISTRO: fedora
# REPO_RELEASE: 34
# fedora-35-x86_64:
# TYPE: rpm
# ARCH: amd64
# REPO_ID: 6196d483ea3a770f011f63fb
# REPO_DISTRO: fedora
# REPO_RELEASE: 35
# fedora-35-aarch64:
# TYPE: rpm
# ARCH: arm64
# REPO_ID: 6196d483ea3a770f011f63fb
# REPO_DISTRO: fedora
# REPO_RELEASE: 35
# fedora-36-x86_64:
# TYPE: rpm
# ARCH: amd64
# REPO_ID: 6271bc683ac6d73aa84d6737
# REPO_DISTRO: fedora
# REPO_RELEASE: 36
# fedora-36-aarch64:
# TYPE: rpm
# ARCH: arm64
# REPO_ID: 6271bc683ac6d73aa84d6737
# REPO_DISTRO: fedora
# REPO_RELEASE: 36
steps:
- ${{ if eq(parameters.artifactBuildId, 0) }}:
- task: DownloadPipelineArtifact@2
inputs:
artifact: linux-$(ARCH)-pkg
path: $(system.defaultWorkingDirectory)/dist/pkg
- ${{ else }}:
- task: DownloadPipelineArtifact@2
inputs:
artifact: linux-$(ARCH)-pkg
path: $(system.defaultWorkingDirectory)/dist/pkg
source: "specific"
project: "release"
pipeline: $(pipelineId)
runVersion: "specific"
runId: ${{ parameters.artifactBuildId }}
- task: PipAuthenticate@1
inputs:
artifactFeeds: 'release/aztfy'
- script: |
set -e
pip install pyOpenSSL --upgrade
pip install pmc-cli
displayName: "Install PMC"
- task: AzureKeyVault@2
displayName: "Get PMC prod certificate"
inputs:
azureSubscription: 'aztfy_pmc'
KeyVaultName: 'aztfy-pmc'
SecretsFilter: 'PMCProdCertificate'
RunAsPreJob: false
- script: |
set -e
pmc_dir=~/.config/pmc
mkdir -p $pmc_dir
echo "$PMC_CERT" > $pmc_dir/aztfexport.pem
cat << EOF > $pmc_dir/settings.toml
[prod]
base_url = "https://pmc-ingest.trafficmanager.net/api/v4"
msal_client_id = "${PMC_CLIENT_ID}"
msal_scope = "api://d48bb382-20ec-41b9-a0ea-07758a21ccd0/.default"
msal_cert_path = "$pmc_dir/aztfexport.pem"
msal_SNIAuth = true
msal_authority = "https://login.microsoftonline.com/MSAzureCloud.onmicrosoft.com"
EOF
pkg=(./dist/pkg/*.${TYPE})
[[ ${#pkg[@]} == 1 ]] || { echo "not exactly one target packages found: $(declare -p pkg)" > 2; exit 1; }
pkg=${pkg[0]}
# Allow error's to occur prior to quit the task, as we are capturing the command output, otherwise, we will have no chance to output that in stdout/stderr.
set +e
# Upload package
ret=$(pmc package upload $pkg)
[[ $? == 0 ]] || { echo "Error: pmc package upload failed: $ret" >&2; exit 1; }
echo -e "pmc package upload returns:\n$ret\n"
id=$(jq -r '.[0].id' <<< $ret)
[[ -n $id ]] || { echo "Error: empty package id got" >&2; exit 1; }
echo "package id: $id"
# Link package to repo
args=(repo package update --add-packages $id $REPO_ID)
if [[ $TYPE == deb ]]; then
args+=($REPO_RELEASE)
fi
ret=$(pmc "${args[@]}")
[[ $? == 0 ]] || { echo "Error: pmc repo package update --add-packages: $ret" >&2; exit 1; }
echo -e "pmc repo package update --add-packages returns:\n$ret\n"
# Publish repo
ret=$(pmc repo publish $REPO_ID)
[[ $? == 0 ]] || { echo "Error: pmc repo publish: $ret" >&2; exit 1; }
echo -e "pmc repo publish returns:\n$ret\n"
displayName: "Publish via pmc"
env:
TYPE: $(TYPE)
REPO_ID: $(REPO_ID)
REPO_RELEASE: $(REPO_RELEASE)
PMC_CLIENT_ID: $(PMC_CLIENT_ID)
PMC_CERT: $(PMCProdCertificate)
- script: |
set -e
# Skip verifying rhel distros as they don't have a docker image available
[[ $REPO_DISTRO == rhel ]] && exit 0
# Install and run kvm service
sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon
sudo systemctl enable --now libvirtd
# Setup binfmt_misc to enable multi arch
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# Launch the base container of the correct architecture
cid=$(docker run --rm -dit --platform=linux/$ARCH ${REPO_DISTRO}:${REPO_RELEASE})
docker cp ${workdir}/scripts/package/linux/verify/${REPO_DISTRO}-${REPO_RELEASE}.sh ${cid}:/verify.sh
docker exec $cid /verify.sh $VERSION
displayName: "Verify"
env:
workdir: $(system.defaultWorkingDirectory)
TYPE: $(TYPE)
ARCH: $(ARCH)
REPO_ID: $(REPO_ID)
REPO_DISTRO: $(REPO_DISTRO)
REPO_RELEASE: $(REPO_RELEASE)
VERSION: ${{ parameters.version }}
- stage: publish_windows_setup
displayName: "Publish Windows Setup"
pool:
name: pool-windows-2019
jobs:
- job: pr
displayName: "PR to winget"
steps:
- pwsh: |
$ErrorActionPreference = "Stop"
cd
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
git clone https://github.com/microsoft/winget-pkgs.git
cd winget-pkgs
..\wingetcreate.exe update --urls https://github.com/Azure/aztfexport/releases/download/$env:VERSION/aztfexport_$($env:VERSION)_x64.msi https://github.com/Azure/aztfexport/releases/download/$env:VERSION/aztfexport_$($env:VERSION)_x86.msi --version $env:VERSION.Substring(1) --submit --token $env:PAT Microsoft.Azure.AztfExport
displayName: "Create PR"
env:
VERSION: ${{ parameters.version }}
PAT: $(AZURE_TERRAFORM_BOT_PAT)
- stage: pr_to_homebrew
displayName: "PR to homebrew"
pool:
name: pool-ubuntu-2004
jobs:
- job: pr
displayName: "PR to homebrew"
steps:
- script: |
set -e
# Install brew
export NONINTERACTIVE=1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# Bump formula
brew tap homebrew/core
cd "$(brew --repository homebrew/core)"
git config user.name "azure-terraform-bot"
git config user.email "[email protected]"
HOMEBREW_GITHUB_API_TOKEN=${PAT} brew bump-formula-pr --version=${VERSION:1} --no-browse --force aztfexport
displayName: "Create PR"
env:
VERSION: ${{ parameters.version }}
PAT: $(AZURE_TERRAFORM_BOT_PAT)