This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline-app-build.yml
99 lines (93 loc) · 2.9 KB
/
pipeline-app-build.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
trigger:
branches:
include:
- main
paths:
include:
- code
- releasePipeline
- pipeline-app-build.yml
- pipeline-template-deploy.yml
- pipeline-release.yml
pool:
vmImage: ubuntu-latest
parameters:
- name: counties
type: object
default:
- 001|1|CountyA
- 002|1|CountyB
- 003|2|CountyC
variables:
County: ''
CountyId: ''
CountyName: ''
FarmId: ''
Prefix: ''
ImageLabel: '12345'
steps:
- script: |
case $(Build.SourceBranchName) in
main)
echo "##vso[task.setvariable variable=Prefix;]prd"
;;
stage)
echo "##vso[task.setvariable variable=Prefix;]stage"
;;
*)
echo "##vso[task.setvariable variable=Prefix;]nprd"
;;
esac
displayName: 'Set Prefix'
- script: echo "$(Prefix)"
displayName: 'Display Prefix'
- script: echo "$(Build.SourceBranchName)"
displayName: 'Display Source Branch Name'
- script: |
rm -rf $(Build.ArtifactStagingDirectory)/manifest.txt
touch $(Build.ArtifactStagingDirectory)/manifest.txt
rm -rf $(Build.ArtifactStagingDirectory)/build-image.txt
echo $(tag) > $(Build.ArtifactStagingDirectory)/build-image.txt
cp -r $(Build.SourcesDirectory)/releasePipeline/release.ps1 $(Build.ArtifactStagingDirectory)
displayName: 'Initialize drop files'
- ${{ each county in parameters.counties }}:
- script: |
IFS='|'
read -a countyInfo <<< "${{county}}"
echo "CountyId: ${countyInfo[0]}"
echo "CountyName : ${countyInfo[2]}"
echo "FarmId : ${countyInfo[1]}"
echo "##vso[task.setvariable variable=County;]${{county}}"
echo "##vso[task.setvariable variable=CountyId;]${countyInfo[0]}"
echo "##vso[task.setvariable variable=FarmId;]${countyInfo[1]}"
echo "##vso[task.setvariable variable=CountyName;]${countyInfo[2]}"
echo "${{county}}" >> $(Build.ArtifactStagingDirectory)/manifest.txt
displayName: 'Execute County: ${{ county }}'
- script: echo "${{county}}"
displayName: 'Display ${{county}}'
- script: echo "$(County)"
displayName: 'Display County'
- script: echo "$(CountyId)"
displayName: 'Display CountyId'
- script: echo "$(CountyName)"
displayName: 'Display CountyName'
- script: echo "$(FarmId)"
displayName: 'Display FarmId'
- template: /pipeline-template-bicep.yml
parameters:
prefix: $(Prefix)
farmId: $(FarmId)
countyId: $(CountyId)
countyName: $(CountyName)
- template: /pipeline-template-deploy.yml
parameters:
prefix: $(Prefix)
farmId: $(FarmId)
countyId: $(CountyId)
countyName: $(CountyName)
imageLabel: $(ImageLabel)
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'