-
Notifications
You must be signed in to change notification settings - Fork 233
/
Copy pathbuild-1es-pipeline.yaml
1244 lines (1100 loc) · 53.6 KB
/
build-1es-pipeline.yaml
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
variables:
AZCOPY_GOLANG_VERSION: '1.24.0'
parameters:
- name: publish_to_container
displayName: 'Publish To Container'
type: boolean
default: false
- name: publish_to_m1_container
displayName: 'Publish To M1 Container'
type: boolean
default: false
- name: publish_docker_image
displayName: 'Build and Push Docker Image'
type: boolean
default: false
- name: post_release
displayName: 'Post Release on Github'
type: boolean
default: false
- name: draft
displayName: 'Post as Draft Release'
type: boolean
default: false
- name: prerelease
displayName: 'Post as PreRelease'
type: boolean
default: false
- name: publish_artifacts
displayName: 'Publish Artifacts to Linux Repos'
type: boolean
default: false
- name: update_version
displayName: 'Update Version'
type: boolean
default: false
# Do not trigger this pipeline automatically
trigger: none
pr: none
resources:
repositories:
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
# The pipeline extends the 1ES PT which will inject different SDL and compliance tasks.
# For non-production pipelines, use "Unofficial" as defined below.
# For productions pipelines, use "Official".
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
parameters:
sdl:
sourceAnalysisPool:
name: azcopy-pool # Name of your hosted pool
image: windows2022-1espt
os: windows # OS of the image. Allowed values: windows, linux, macOS
stages:
- stage: AzCopyVersion
jobs:
- job: GetAzCopyVersion
pool:
name: azcopy-pool
image: ubuntu22-1espt
os: linux
steps:
- checkout: self
displayName: 'Checkout repository'
- task: GoTool@0
env:
GO111MODULE: 'on'
inputs:
version: $(AZCOPY_GOLANG_VERSION)
- script: |
go build -tags "netgo" -o azcopy
displayName: 'Build AzCopy'
- script: |
# Run azcopy --version and capture the output
azcopyOutput=$(./azcopy --version)
# Extract the version part
if echo "$azcopyOutput" | grep -q "azcopy version"; then
version=$(echo "$azcopyOutput" | sed -n 's/^azcopy version \([0-9]*\.[0-9]*\.[0-9]*[^ ]*\).*/\1/p')
if [[ -n "$version" ]]; then
echo "Extracted version: $version"
echo "##vso[task.setvariable variable=azcopy_version;isOutput=true]$version"
else
echo "Unable to extract version from azcopy output"
exit 1
fi
else
echo "azcopy version string not found in output"
exit 1
fi
displayName: 'Verify and extract the generated build version'
name: SetAzCopyVersion
- stage: BuildArtifacts
dependsOn: AzCopyVersion
jobs:
- job: Linux_Amd64
timeoutInMinutes: 120
pool:
name: azcopy-pool
image: ubuntu20-custom1espt
os: linux
templateContext:
outputs:
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/unsigned
artifactName: 'azcopy-linux-amd64-unsigned'
displayName: 'Upload Linux Amd64 Unsigned'
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/binaries
artifactName: 'azcopy-binaries-linux-amd64'
displayName: 'Upload Linux Amd64 Binaries'
variables:
- name: archives
value: $(System.DefaultWorkingDirectory)/archives
- name: unsigned
value: $(System.DefaultWorkingDirectory)/unsigned
- name: binaries
value: $(System.DefaultWorkingDirectory)/binaries
- name: azcopy_version
value: $[ stageDependencies.AzCopyVersion.GetAzCopyVersion.outputs['SetAzCopyVersion.azcopy_version'] ]
steps:
- template: azurePipelineTemplates/build_linux.yml@self
parameters:
host_architecture: 'amd64'
host_suffix: 'x86_64'
- job: Linux_Arm64
timeoutInMinutes: 120
pool:
name: azcopy-arm-pool
image: ubuntu20arm-custom1espt
os: linux
hostArchitecture: Arm64
templateContext:
outputs:
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/unsigned
artifactName: 'azcopy-linux-arm64-unsigned'
displayName: 'Upload Linux Arm64 Unsigned'
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/binaries
artifactName: 'azcopy-binaries-linux-arm64'
displayName: 'Upload Linux Arm64 Binaries'
variables:
- name: archives
value: $(System.DefaultWorkingDirectory)/archives
- name: unsigned
value: $(System.DefaultWorkingDirectory)/unsigned
- name: binaries
value: $(System.DefaultWorkingDirectory)/binaries
- name: azcopy_version
value: $[ stageDependencies.AzCopyVersion.GetAzCopyVersion.outputs['SetAzCopyVersion.azcopy_version'] ]
steps:
- template: azurePipelineTemplates/build_linux.yml@self
parameters:
host_architecture: 'arm64'
host_suffix: 'arm64'
- job: Windows
timeoutInMinutes: 120
pool:
name: azcopy-pool
image: windows2022-1espt
os: windows
# If the pipeline publishes artifacts, use `templateContext` to define the artifacts.
# This will enable 1ES PT to run SDL analysis tools on the artifacts and then upload them.
templateContext:
outputs:
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)\binaries
artifactName: 'azcopy-windows-unsigned'
displayName: 'Upload Windows Unsigned'
variables:
- name: binaries
value: '$(System.DefaultWorkingDirectory)\binaries'
steps:
- template: azurePipelineTemplates/build_windows.yml@self
- job: MacOS
timeoutInMinutes: 360
pool:
name: Azure Pipelines
image: macos-latest
os: macOS
templateContext:
outputs:
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/unsigned
artifactName: 'azcopy-mac-unsigned'
displayName: 'Upload Mac Unsigned'
variables:
- name: unsigned
value: $(System.DefaultWorkingDirectory)/unsigned
- name: azcopy_version
value: $[ stageDependencies.AzCopyVersion.GetAzCopyVersion.outputs['SetAzCopyVersion.azcopy_version'] ]
steps:
- template: azurePipelineTemplates/build_macos.yml@self
- job: MacOS_M1
timeoutInMinutes: 360
pool:
name: azcopy-pool
image: ubuntu22-1espt
os: linux
templateContext:
outputs:
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/unsigned
artifactName: 'azcopy-mac-m1-unsigned'
displayName: 'Upload Mac M1 Unsigned'
variables:
- group: AZCOPY_TESTS_VAR
- name: unsigned
value: $(System.DefaultWorkingDirectory)/unsigned
- name: azcopy_version
value: $[ stageDependencies.AzCopyVersion.GetAzCopyVersion.outputs['SetAzCopyVersion.azcopy_version'] ]
steps:
- template: azurePipelineTemplates/build_macos_m1.yml@self
# BuildArtifacts end here
- stage: SignArtifacts
dependsOn:
- AzCopyVersion
- BuildArtifacts
jobs:
- job: Linux
timeoutInMinutes: 120
pool:
name: azcopy-pool
image: ubuntu22-1espt
os: linux
templateContext:
inputs:
- input: pipelineArtifact
artifactName: azcopy-linux-amd64-unsigned
targetPath: $(System.DefaultWorkingDirectory)/amd64
displayName: 'Download Linux Amd64 Unsigned'
- input: pipelineArtifact
artifactName: azcopy-linux-arm64-unsigned
targetPath: $(System.DefaultWorkingDirectory)/arm64
displayName: 'Download Linux Arm64 Unsigned'
outputs:
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/signed
artifactName: 'azcopy-linux-signed'
displayName: 'Upload Linux Signed'
variables:
- group: AZCOPY_SECRET_VAULT
- name: amd64
value: $(System.DefaultWorkingDirectory)/amd64
- name: arm64
value: $(System.DefaultWorkingDirectory)/arm64
- name: mariner
value: $(System.DefaultWorkingDirectory)/mariner
- name: signed
value: $(System.DefaultWorkingDirectory)/signed
steps:
- checkout: none
- script: |
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -f --fix-missing
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt install apt-transport-https -y
sudo apt install dotnet-sdk-6.0 -y
displayName: "Update dependencies"
- script: |
mkdir -p $(mariner)
chmod 755 $(mariner)
cp $(amd64)/*x86_64.rpm $(mariner)
cp $(arm64)/*arm64.rpm $(mariner)
displayName: 'Copy artifacts for Mariner'
- template: setup/esrp_sign_linux.yml@self
parameters:
FolderPath: $(amd64)
ESRP_AZCOPY_KEY_CODE: $(ESRP_AZCOPY_KEY_CODE)
Pattern: '*.rpm, *.deb'
DisplayName: 'ESRP CodeSigning azcopy linux amd64'
- template: setup/esrp_sign_linux.yml@self
parameters:
FolderPath: $(arm64)
ESRP_AZCOPY_KEY_CODE: $(ESRP_AZCOPY_KEY_CODE)
Pattern: '*.rpm, *.deb'
DisplayName: 'ESRP CodeSigning azcopy linux arm64'
- template: setup/esrp_sign_linux.yml@self
parameters:
FolderPath: $(mariner)
ESRP_AZCOPY_KEY_CODE: $(ESRP_AZCOPY_MARINER_KEY_CODE)
Pattern: '*.rpm, *.deb'
DisplayName: 'ESRP CodeSigning azcopy mariner'
- script: |
mkdir -p $(signed)
mkdir -p $(signed)/mariner
chmod 755 $(amd64)/*
rm -rf $(amd64)/*.md
mv $(amd64)/* $(signed)
chmod 755 $(arm64)/*
rm -rf $(arm64)/*.md
mv $(arm64)/* $(signed)
chmod 755 $(mariner)/*
rm -rf $(mariner)/*.md
mv $(mariner)/* $(signed)/mariner
displayName: 'Make Artifacts executable'
- job: Windows
timeoutInMinutes: 120
pool:
name: azcopy-pool
image: ubuntu22-1espt
os: linux
templateContext:
inputs:
- input: pipelineArtifact
artifactName: azcopy-windows-unsigned
targetPath: $(System.DefaultWorkingDirectory)/windows
displayName: 'Download Windows Unsigned'
outputs:
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/signed
artifactName: 'azcopy-windows-signed'
displayName: 'Upload Windows Signed'
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/binaries
artifactName: 'azcopy-binaries-windows'
displayName: 'Upload Windows Binaries'
variables:
- group: AZCOPY_SECRET_VAULT
- name: windows
value: '$(System.DefaultWorkingDirectory)/windows'
- name: signed
value: '$(System.DefaultWorkingDirectory)/signed'
- name: binaries
value: '$(System.DefaultWorkingDirectory)/binaries'
- name: azcopy_version
value: $[ stageDependencies.AzCopyVersion.GetAzCopyVersion.outputs['SetAzCopyVersion.azcopy_version'] ]
steps:
- script: |
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -f --fix-missing
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt install apt-transport-https -y
sudo apt install dotnet-sdk-6.0 -y
sudo apt-get install -y zip
displayName: "Update dependencies"
- template: setup/esrp_sign_windows.yml@self
parameters:
FolderPath: $(windows)
ESRP_AZCOPY_WIN_KEY_CODE: $(ESRP_AZCOPY_WIN_KEY_CODE)
Pattern: 'azcopy_windows*'
- script: |
mkdir -p $(binaries)
mkdir -p $(signed)
chmod 755 $(windows)/*
rm -rf $(windows)/*.md
displayName: 'Make Artifacts executable'
- script: |
windows_amd64="$(System.DefaultWorkingDirectory)/azcopy_windows_amd64_$(azcopy_version)"
echo "##vso[task.setvariable variable=windows_amd64]$windows_amd64"
windows_arm64="$(System.DefaultWorkingDirectory)/azcopy_windows_arm64_$(azcopy_version)"
echo "##vso[task.setvariable variable=windows_arm64]$windows_arm64"
windows_386="$(System.DefaultWorkingDirectory)/azcopy_windows_386_$(azcopy_version)"
echo "##vso[task.setvariable variable=windows_386]$windows_386"
mkdir -p $windows_amd64
mkdir -p $windows_arm64
mkdir -p $windows_386
displayName: 'Create required directories'
- script: |
cp $(windows)/* $(System.DefaultWorkingDirectory)/binaries
rm -rf $(windows)/azcopy_windows_v7_arm.exe
mv $(windows)/azcopy_windows_amd64.exe $(windows_amd64)/azcopy.exe
cp NOTICE.txt $(windows_amd64)
mv $(windows)/azcopy_windows_arm64.exe $(windows_arm64)/azcopy.exe
cp NOTICE.txt $(windows_arm64)
mv $(windows)/azcopy_windows_386.exe $(windows_386)/azcopy.exe
cp NOTICE.txt $(windows_386)
displayName: 'Copy required files'
- task: ArchiveFiles@2
displayName: 'Archive Windows 64 bit AMD Build'
inputs:
rootFolderOrFile: '$(windows_amd64)'
archiveFile: '$(signed)/azcopy_windows_amd64_$(azcopy_version).zip'
- task: ArchiveFiles@2
displayName: 'Archive Windows 64 bit ARM Build'
inputs:
rootFolderOrFile: '$(windows_arm64)'
archiveFile: '$(signed)/azcopy_windows_arm64_$(azcopy_version).zip'
- task: ArchiveFiles@2
displayName: 'Archive Windows 32 bit Build'
inputs:
rootFolderOrFile: '$(windows_386)'
archiveFile: '$(signed)/azcopy_windows_386_$(azcopy_version).zip'
- job: Mac
timeoutInMinutes: 120
pool:
name: azcopy-pool
image: ubuntu22-1espt
os: linux
templateContext:
inputs:
- input: pipelineArtifact
artifactName: azcopy-mac-unsigned
targetPath: $(System.DefaultWorkingDirectory)/mac
displayName: 'Download Mac Unsigned'
- input: pipelineArtifact
artifactName: azcopy-mac-m1-unsigned
targetPath: $(System.DefaultWorkingDirectory)/mac-m1
displayName: 'Download Mac M1 Unsigned'
outputs:
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/signed
artifactName: 'azcopy-mac-signed'
displayName: 'Upload Mac Signed'
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/binaries
artifactName: 'azcopy-binaries-mac'
displayName: 'Upload Mac Binaries'
variables:
- group: AZCOPY_SECRET_VAULT
- name: mac
value: '$(System.DefaultWorkingDirectory)/mac'
- name: mac-m1
value: '$(System.DefaultWorkingDirectory)/mac-m1'
- name: signed
value: '$(System.DefaultWorkingDirectory)/signed'
- name: binaries
value: '$(System.DefaultWorkingDirectory)/binaries'
steps:
- checkout: none
- script: |
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install unzip -y
sudo apt-get install -f --fix-missing
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt install apt-transport-https -y
sudo apt install dotnet-sdk-6.0 -y
displayName: "Update dependencies"
- template: setup/esrp_sign_notarize_macos.yml@self
parameters:
FolderPath: $(mac)
ESRP_AZCOPY_MAC_KEY_CODE: $(ESRP_AZCOPY_MAC_KEY_CODE)
Pattern: '*.zip'
- template: setup/esrp_sign_notarize_macos.yml@self
parameters:
FolderPath: $(mac-m1)
ESRP_AZCOPY_MAC_KEY_CODE: $(ESRP_AZCOPY_MAC_KEY_CODE)
Pattern: '*.zip'
# Validate signed images have md5sum changed
- script: |
mkdir -p $(binaries)
mkdir -p $(signed)
chmod 755 $(mac)/*
rm -rf $(mac)/*.md
chmod 755 $(mac-m1)/*
rm -rf $(mac-m1)/*.md
displayName: 'Make Artifacts executable'
- script: |
mv $(mac)/azcopy* $(signed)/
mv $(mac-m1)/azcopy* $(signed)/
displayName: 'Copy required files'
- script: |
mkdir -p unzipped_amd64
unzip -o $(signed)/azcopy*amd64*.zip -d unzipped_amd64
# Use find to retrieve the folder name
amd64FolderName=$(find unzipped_amd64 -maxdepth 1 -type d -name "azcopy_darwin_amd64*")
echo "AMD64 Folder name: $amd64FolderName"
# Check if there is exactly one matching directory for amd64
if [ $(echo "$amd64FolderName" | wc -l) -eq 1 ]; then
echo "Found matching AMD64 directory: $amd64FolderName"
mv $amd64FolderName/azcopy $(binaries)/azcopy_darwin_amd64
else
echo "Error: Expected exactly one matching AMD64 directory, found $(echo "$amd64FolderName" | wc -l)."
exit 1
fi
mkdir -p unzipped_arm64
unzip -o $(signed)/azcopy_darwin_arm64*.zip -d unzipped_arm64
arm64FolderName=$(find unzipped_arm64 -maxdepth 1 -type d -name "azcopy_darwin_arm64*")
echo "ARM64 Folder name: $arm64FolderName"
# Check if there is exactly one matching directory for arm64
if [ $(echo "$arm64FolderName" | wc -l) -eq 1 ]; then
echo "Found matching ARM64 directory: $arm64FolderName"
mv $arm64FolderName/azcopy $(binaries)/azcopy_darwin_arm64
else
echo "Error: Expected exactly one matching ARM64 directory, found $(echo "$arm64FolderName" | wc -l)."
exit 1
fi
mkdir -p unzipped_m1_arm64
unzip -o $(signed)/azcopy_darwin_m1_arm64*.zip -d unzipped_m1_arm64
m1Arm64FolderName=$(find unzipped_m1_arm64 -maxdepth 1 -type d -name "azcopy_darwin_m1_arm64*")
echo "ARM64 M1 Folder name: $m1Arm64FolderName"
# Check if there is exactly one matching directory for arm64
if [ $(echo "$m1Arm64FolderName" | wc -l) -eq 1 ]; then
echo "Found matching ARM64 M1 directory: $m1Arm64FolderName"
mv $m1Arm64FolderName/azcopy $(binaries)/azcopy_darwin_m1_arm64
else
echo "Error: Expected exactly one matching ARM64 M1 directory, found $(echo "$m1Arm64FolderName" | wc -l)."
exit 1
fi
displayName: 'Copy signed mac binaries'
# SignArtifacts end here
- stage: VerifyArtifacts
dependsOn: SignArtifacts
jobs:
- job: Ubuntu_Amd64
timeoutInMinutes: 120
pool:
name: azcopy-pool
image: ubuntu20-custom1espt
os: linux
templateContext:
inputs:
- input: pipelineArtifact
artifactName: azcopy-binaries-linux-amd64
targetPath: $(System.DefaultWorkingDirectory)/binaries
displayName: 'Download Linux Amd64 Binaries'
- input: pipelineArtifact
artifactName: azcopy-linux-signed
targetPath: $(System.DefaultWorkingDirectory)/signed
displayName: 'Download Linux Signed'
variables:
- name: signed
value: '$(System.DefaultWorkingDirectory)/signed'
- name: binaries
value: '$(System.DefaultWorkingDirectory)/binaries'
- name: extracted
value: '$(System.DefaultWorkingDirectory)/extracted'
steps:
- template: azurePipelineTemplates/verify_linux.yml@self
parameters:
host_architecture: 'amd64'
host_suffix: 'x86_64'
- job: Ubuntu_Arm64
timeoutInMinutes: 120
pool:
name: azcopy-arm-pool
image: ubuntu20arm-custom1espt
os: linux
hostArchitecture: Arm64
templateContext:
inputs:
- input: pipelineArtifact
artifactName: azcopy-binaries-linux-arm64
targetPath: $(System.DefaultWorkingDirectory)/binaries
displayName: 'Download Linux Arm64 Binaries'
- input: pipelineArtifact
artifactName: azcopy-linux-signed
targetPath: $(System.DefaultWorkingDirectory)/signed
displayName: 'Download Linux Signed'
variables:
- name: signed
value: '$(System.DefaultWorkingDirectory)/signed'
- name: binaries
value: '$(System.DefaultWorkingDirectory)/binaries'
- name: extracted
value: '$(System.DefaultWorkingDirectory)/extracted'
steps:
- template: azurePipelineTemplates/verify_linux.yml@self
parameters:
host_architecture: 'arm64'
host_suffix: 'arm64'
- job: Mariner_Amd64
timeoutInMinutes: 120
pool:
name: azcopy-pool
image: mariner2-1espt
os: linux
templateContext:
inputs:
- input: pipelineArtifact
artifactName: azcopy-linux-signed
targetPath: $(System.DefaultWorkingDirectory)/signed
item_pattern: 'mariner/azcopy-*x86_64.rpm'
displayName: 'Download Linux Signed'
variables:
- name: signed
value: '$(System.DefaultWorkingDirectory)/signed/mariner'
steps:
- checkout: none
- script: |
sudo rpm -qip $(signed)/azcopy*x86_64.rpm
sudo rpm -i $(signed)/azcopy*x86_64.rpm
azcopy --version
displayName: 'Verify rpm'
- job: MacOS
timeoutInMinutes: 120
pool:
name: Azure Pipelines
image: macos-latest
os: macOS
templateContext:
inputs:
- input: pipelineArtifact
artifactName: azcopy-mac-signed
targetPath: $(System.DefaultWorkingDirectory)/signed
itemPattern: 'azcopy*amd64*.zip'
displayName: 'Download Mac Signed'
variables:
- name: signed
value: '$(System.DefaultWorkingDirectory)/signed'
- name: extracted
value: '$(System.DefaultWorkingDirectory)/extracted'
steps:
- checkout: none
- script: |
mkdir -p $(extracted)
displayName: 'Create extracted path'
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(signed)/azcopy*amd64*.zip'
destinationFolder: $(extracted)
- script: |
$(extracted)/azcopy*amd64*/azcopy --version
displayName: 'Verify binary in zip'
- job: Windows_Amd64
timeoutInMinutes: 120
pool:
name: azcopy-pool
image: windows2022-1espt
os: windows
templateContext:
inputs:
- input: pipelineArtifact
artifactName: azcopy-windows-signed
targetPath: $(System.DefaultWorkingDirectory)\signed
itemPattern: 'azcopy*amd64*.zip'
displayName: 'Download Windows Signed'
variables:
- name: signed
value: '$(System.DefaultWorkingDirectory)\signed'
- name: extracted
value: '$(System.DefaultWorkingDirectory)\extracted'
steps:
- checkout: none
- script: |
mkdir -p $(extracted)
displayName: 'Create extracted path'
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(signed)\azcopy*amd64*.zip'
destinationFolder: $(extracted)
- script: |
cd $(extracted)\azcopy*amd64*
azcopy.exe --version
displayName: 'Verify exe in zip'
- job: Windows_Arm64
timeoutInMinutes: 120
pool:
name: azcopy-arm-pool
image: windows2022arm-1espt
os: windows
hostArchitecture: Arm64
templateContext:
inputs:
- input: pipelineArtifact
artifactName: azcopy-windows-signed
targetPath: $(System.DefaultWorkingDirectory)\signed
itemPattern: 'azcopy*arm64*.zip'
displayName: 'Download Windows Signed'
variables:
- name: signed
value: '$(System.DefaultWorkingDirectory)\signed'
- name: extracted
value: '$(System.DefaultWorkingDirectory)\extracted'
steps:
- checkout: none
- script: |
mkdir -p $(extracted)
displayName: 'Create extracted path'
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(signed)\azcopy*arm64*.zip'
destinationFolder: $(extracted)
- script: |
cd $(extracted)\azcopy*arm64*
azcopy.exe --version
displayName: 'Verify exe in zip'
# VerifyArtifacts end here
- stage: UploadToStorage
dependsOn:
- AzCopyVersion
- VerifyArtifacts
jobs:
- job: Job
pool:
name: azcopy-pool
image: ubuntu22-1espt
os: linux
variables:
- name: input
value: '$(System.DefaultWorkingDirectory)/input'
- name: release
value: '$(System.DefaultWorkingDirectory)/release'
- name: drop
value: '$(System.DefaultWorkingDirectory)/drop'
- name: publish_to_m1_container
value: ${{ parameters.publish_to_m1_container }}
- name: azcopy_version
value: $[ stageDependencies.AzCopyVersion.GetAzCopyVersion.outputs['SetAzCopyVersion.azcopy_version'] ]
steps:
- checkout: self
displayName: 'Checkout repository'
- script: |
sudo apt-get clean
sudo apt-get update --fix-missing
sudo apt-get install -y zip unzip
displayName: 'Install Dependencies'
- task: GoTool@0
env:
GO111MODULE: 'on'
inputs:
version: $(AZCOPY_GOLANG_VERSION)
- script: |
go build -tags "netgo" -o azcopy
displayName: 'Build AzCopy'
# DownloadPipelineArtifacts AFTER checkout since checkout wipes out the DefaultWorkingDirectory
- task: DownloadPipelineArtifact@2
inputs:
artifactName: azcopy-linux-signed
targetPath: $(System.DefaultWorkingDirectory)/input/azcopy-linux-signed
displayName: "Download Linux Signed"
- task: DownloadPipelineArtifact@2
inputs:
artifactName: azcopy-windows-signed
targetPath: $(System.DefaultWorkingDirectory)/input/azcopy-windows-signed
displayName: "Download Windows Signed"
- task: DownloadPipelineArtifact@2
inputs:
artifactName: azcopy-mac-signed
targetPath: $(System.DefaultWorkingDirectory)/input/azcopy-mac-signed
displayName: "Download Mac Signed"
- script: |
mkdir -p $(release)
cp $(input)/azcopy-linux-signed/azcopy* $(release)
cp $(input)/azcopy-windows-signed/azcopy* $(release)
cp $(input)/azcopy-mac-signed/azcopy* $(release)
displayName: 'Prepare release folder'
- task: DownloadPipelineArtifact@2
inputs:
artifactName: azcopy-binaries-linux-amd64
targetPath: $(System.DefaultWorkingDirectory)/input/azcopy-binaries-linux-amd64
displayName: "Download Linux AMD64 Binaries"
- task: DownloadPipelineArtifact@2
inputs:
artifactName: azcopy-binaries-linux-arm64
targetPath: $(System.DefaultWorkingDirectory)/input/azcopy-binaries-linux-arm64
displayName: "Download Linux ARM64 Binaries"
- task: DownloadPipelineArtifact@2
inputs:
artifactName: azcopy-binaries-windows
targetPath: $(System.DefaultWorkingDirectory)/input/azcopy-binaries-windows
displayName: "Download Windows Binaries"
- task: DownloadPipelineArtifact@2
inputs:
artifactName: azcopy-binaries-mac
targetPath: $(System.DefaultWorkingDirectory)/input/azcopy-binaries-mac
displayName: "Download Mac Binaries"
- script: |
mkdir -p $(drop)
cp $(input)/azcopy-binaries-linux-amd64/azcopy* $(drop)
cp $(input)/azcopy-binaries-linux-arm64/azcopy* $(drop)
cp $(input)/azcopy-binaries-windows/azcopy* $(drop)
cp $(input)/azcopy-binaries-mac/azcopy* $(drop)
cp $(System.DefaultWorkingDirectory)/NOTICE.txt $(drop)
displayName: 'Prepare drop folder'
- task: ArchiveFiles@2
displayName: 'Archive drop'
inputs:
rootFolderOrFile: '$(drop)'
archiveFile: '$(release)/drop.zip'
- task: AzureCLI@2
inputs:
azureSubscription: 'ESRP KeyVault identity'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
today=$(date +"%Y%m%d")
container_url="https://azcopyprivatedrops.blob.core.windows.net/%24web/releases/release-$(azcopy_version)-$today"
echo "Artifacts will be uploaded to private drop container: $container_url"
AZCOPY_AUTO_LOGIN_TYPE=AzCLI ./azcopy cp "$(release)/*" "$container_url" --recursive --put-md5=true
if [ $(publish_to_m1_container) = "True" ]; then
m1_container_url="https://azcopyvnextrelease.blob.core.windows.net/%24web/azcopy-m1-drops/azcopy-$(azcopy_version)-$today"
AZCOPY_AUTO_LOGIN_TYPE=AzCLI ./azcopy cp "$(input)/azcopy-binaries-mac/azcopy_darwin_m1_arm64" "$m1_container_url" --recursive --put-md5=true
fi
# UploadToStorage ends here
- ${{ if eq(parameters.publish_docker_image, true) }}:
- stage: BuildAndPublishDockerImage
dependsOn:
- AzCopyVersion
- VerifyArtifacts
jobs:
- job: LinuxAMD64
pool:
name: azcopy-pool
image: ubuntu22-1espt
os: linux
templateContext:
authenticatedContainerRegistries:
- serviceConnection: AzCopyContainers_ACR
variables:
- group: AZCOPY_SECRET_VAULT
- name: azcopy_version
value: $[ lower(stageDependencies.AzCopyVersion.GetAzCopyVersion.outputs['SetAzCopyVersion.azcopy_version']) ]
steps:
- checkout: self
displayName: 'Checkout repository'
- task: DownloadPipelineArtifact@2
inputs:
artifactName: azcopy-binaries-linux-amd64
targetPath: $(System.DefaultWorkingDirectory)
itemPattern: 'azcopy_linux_amd64'
displayName: "Download Linux AMD64 Binary"
- script: |
mv azcopy_linux_amd64 azcopy
displayName: 'Setup AzCopy in expected location'
- task: 1ES.BuildContainerImage@1
inputs:
image: azcopycontainers.azurecr.io/azure-azcopy-ubuntu-x86_64.$(azcopy_version):latest
path: '$(System.DefaultWorkingDirectory)'
dockerfile: docker/Dockerfile
- task: 1ES.PushContainerImage@1
inputs:
image: azcopycontainers.azurecr.io/azure-azcopy-ubuntu-x86_64.$(azcopy_version):latest
remoteImage: azcopycontainers.azurecr.io/azure-azcopy-ubuntu-x86_64.$(azcopy_version):latest
- task: 1ES.BuildContainerImage@1
inputs:
image: azcopycontainers.azurecr.io/azure-azcopy-mariner-x86_64.$(azcopy_version):latest
path: '$(System.DefaultWorkingDirectory)'
dockerfile: docker/DockerfileMariner
- task: 1ES.PushContainerImage@1
inputs:
image: azcopycontainers.azurecr.io/azure-azcopy-mariner-x86_64.$(azcopy_version):latest
remoteImage: azcopycontainers.azurecr.io/azure-azcopy-mariner-x86_64.$(azcopy_version):latest
- task: 1ES.BuildContainerImage@1
inputs:
image: azcopycontainers.azurecr.io/azure-azcopy-mariner-arm64.$(azcopy_version):latest
path: '$(System.DefaultWorkingDirectory)'
dockerfile: docker/DockerfileMarinerArm64
- task: 1ES.PushContainerImage@1
inputs:
image: azcopycontainers.azurecr.io/azure-azcopy-mariner-arm64.$(azcopy_version):latest
remoteImage: azcopycontainers.azurecr.io/azure-azcopy-mariner-arm64.$(azcopy_version):latest
- job: LinuxARM64
pool:
name: azcopy-arm-pool
image: ubuntu22arm-custom1espt
os: linux
hostArchitecture: Arm64
templateContext:
authenticatedContainerRegistries:
- serviceConnection: AzCopyContainers_ACR
variables:
- group: AZCOPY_SECRET_VAULT
- name: azcopy_version
value: $[ lower(stageDependencies.AzCopyVersion.GetAzCopyVersion.outputs['SetAzCopyVersion.azcopy_version']) ]
steps:
- checkout: self
displayName: 'Checkout repository'
- task: DownloadPipelineArtifact@2
inputs:
artifactName: azcopy-binaries-linux-arm64
targetPath: $(System.DefaultWorkingDirectory)
itemPattern: 'azcopy_linux_arm64'
displayName: "Download Linux ARM64 Binary"
- script: |
mv azcopy_linux_arm64 azcopy
displayName: 'Setup AzCopy in expected location'
- task: 1ES.BuildContainerImage@1
inputs:
image: azcopycontainers.azurecr.io/azure-azcopy-ubuntu-arm64.$(azcopy_version):latest
path: '$(System.DefaultWorkingDirectory)'
dockerfile: docker/Dockerfile
- task: 1ES.PushContainerImage@1
inputs:
image: azcopycontainers.azurecr.io/azure-azcopy-ubuntu-arm64.$(azcopy_version):latest
remoteImage: azcopycontainers.azurecr.io/azure-azcopy-ubuntu-arm64.$(azcopy_version):latest
- ${{ if eq(parameters.post_release, true) }}:
- stage: ReleaseToGithub
dependsOn:
- AzCopyVersion
- VerifyArtifacts
jobs:
- job: Job
pool:
name: azcopy-pool
image: ubuntu22-1espt
os: linux