-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipelines-build.yml
286 lines (282 loc) · 10.8 KB
/
azure-pipelines-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
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
trigger:
branches:
include:
- main
pr: none
parameters:
- name: runValidation
displayName: Run linting and tests
type: boolean
default: true
- name: buildAppealsApi
displayName: Build Appeals Service API
type: boolean
default: true
- name: buildAuthServer
displayName: Build Auth Server
type: boolean
default: false
- name: buildDocumentsApi
displayName: Build Documents Service API
type: boolean
default: false
- name: buildIntegrationFunctions
displayName: Build Integration Functions
type: boolean
default: true
- name: buildPdfApi
displayName: Build PDF Service API
type: boolean
default: false
- name: buildWeb
displayName: Build Web Appeal
type: boolean
default: true
resources:
repositories:
- repository: templates
type: github
endpoint: Planning-Inspectorate
name: Planning-Inspectorate/common-pipeline-templates
ref: refs/tags/release/3.18.2
extends:
template: stages/wrapper_ci.yml@templates
parameters:
globalVariables:
- template: azure-pipelines-variables.yml@self
validationJobs:
- name: Run Linting & Tests
condition: ${{ eq(parameters.runValidation, true) }}
steps:
- template: ../steps/node_script.yml
parameters:
nodeVersion: 20
script: npm ci
- template: ../steps/node_script.yml
parameters:
condition: succeededOrFailed()
script: npm run lint
nodeVersion: 20
- template: ../steps/node_script.yml
parameters:
condition: succeededOrFailed()
script: npm run test
nodeVersion: 20
- template: ../steps/node_script.yml
parameters:
condition: and(succeededOrFailed(),eq(variables['Build.SourceBranchName'], 'main'))
script: npm run integration-test
nodeVersion: 20
- template: ../steps/check_changed_files.yml
parameters:
pathFilters:
- name: appeals-api
path: packages/appeals-service-api
- name: auth-server
path: packages/auth-server
- name: business-rules
path: packages/business-rules
- name: common
path: packages/common
- name: database
path: packages/database
- name: documents-api
path: packages/document-service-api
- name: integration-functions
path: packages/integration-functions
- name: pdf-api
path: packages/pdf-service-api
- name: web
path: packages/forms-web-app
stepName: check_files
- name: Build Appeals API
condition: >-
and(
ne(variables['Agent.JobStatus'], 'Failed'),
or(
and(
eq(variables['Build.Reason'], 'Manual'),
eq(${{ parameters.buildAppealsApi }}, 'true')
),
and(
ne(variables['Build.Reason'], 'Manual'),
or(
eq(variables['Build.SourceBranchName'], 'main'),
eq(dependencies.run_linting_and_tests.outputs['check_files.appeals-api'], 'true'),
eq(dependencies.run_linting_and_tests.outputs['check_files.business-rules'], 'true'),
eq(dependencies.run_linting_and_tests.outputs['check_files.common'], 'true'),
eq(dependencies.run_linting_and_tests.outputs['check_files.database'], 'true')
)
)
)
)
dependsOn:
- Run Linting & Tests
steps:
- template: ../steps/azure_web_app_docker_build_push.yml@templates
parameters:
azurecrName: $(azurecrName)
dockerfilePath: $(Build.SourcesDirectory)/packages/appeals-service-api/Dockerfile
repository: appeal-planning-decision/appeals-service-api
buildArgs:
- GIT_SHA=$(Build.SourceVersion)
- name: Build Auth Server
condition: >-
and(
ne(variables['Agent.JobStatus'], 'Failed'),
or(
and(
eq(variables['Build.Reason'], 'Manual'),
eq(${{ parameters.buildAuthServer }}, 'true')
),
and(
ne(variables['Build.Reason'], 'Manual'),
or(
eq(variables['Build.SourceBranchName'], 'main'),
eq(dependencies.run_linting_and_tests.outputs['check_files.auth-server'], 'true'),
eq(dependencies.run_linting_and_tests.outputs['check_files.common'], 'true'),
eq(dependencies.run_linting_and_tests.outputs['check_files.database'], 'true')
)
)
)
)
dependsOn:
- Run Linting & Tests
steps:
- template: ../steps/azure_web_app_docker_build_push.yml@templates
parameters:
azurecrName: $(azurecrName)
dockerfilePath: $(Build.SourcesDirectory)/packages/auth-server/Dockerfile
repository: appeal-planning-decision/auth-server
buildArgs:
- GIT_SHA=$(Build.SourceVersion)
- name: Build Documents API
condition: >-
and(
ne(variables['Agent.JobStatus'], 'Failed'),
or(
and(
eq(variables['Build.Reason'], 'Manual'),
eq(${{ parameters.buildDocumentsApi }}, 'true')
),
and(
ne(variables['Build.Reason'], 'Manual'),
or(
eq(variables['Build.SourceBranchName'], 'main'),
eq(dependencies.run_linting_and_tests.outputs['check_files.documents-api'], 'true'),
eq(dependencies.run_linting_and_tests.outputs['check_files.common'], 'true')
)
)
)
)
dependsOn:
- Run Linting & Tests
steps:
- template: ../steps/azure_web_app_docker_build_push.yml@templates
parameters:
azurecrName: $(azurecrName)
dockerfilePath: $(Build.SourcesDirectory)/packages/document-service-api/Dockerfile
repository: appeal-planning-decision/documents-api
buildArgs:
- GIT_SHA=$(Build.SourceVersion)
- name: Build Integration Functions
condition: >-
and(
ne(variables['Agent.JobStatus'], 'Failed'),
or(
and(
eq(variables['Build.Reason'], 'Manual'),
eq(${{ parameters.buildIntegrationFunctions }}, 'true')
),
and(
ne(variables['Build.Reason'], 'Manual'),
or(
eq(variables['Build.SourceBranchName'], 'main'),
eq(dependencies.run_linting_and_tests.outputs['check_files.integration-functions'], 'true')
)
)
)
)
dependsOn:
- Run Linting & Tests
steps:
- template: ../steps/node_script.yml
parameters:
nodeVersion: 20
script: npm ci --omit=dev --workspace=integration-functions --workspace=@pins/common
workingDirectory: $(Build.Repository.LocalPath)
- script: |
source ~/.bashrc
# ensure there is a @pins/common folder
mkdir -p $(Build.Repository.LocalPath)/packages/integration-functions/node_modules/@pins/common
# copy root node_modules to function (but don't overwrite)
rsync -a -r --ignore-existing $(Build.Repository.LocalPath)/node_modules/ $(Build.Repository.LocalPath)/packages/integration-functions/node_modules/
# copy common package to @pins/common folder
cp -r $(Build.Repository.LocalPath)/packages/common/* $(Build.Repository.LocalPath)/packages/integration-functions/node_modules/@pins/common/
- task: ArchiveFiles@2
displayName: Archive files
inputs:
rootFolderOrFile: $(Build.Repository.LocalPath)/packages/integration-functions
includeRootFolder: false
archiveFile: $(System.DefaultWorkingDirectory)/functions.zip
- publish: $(System.DefaultWorkingDirectory)/functions.zip
artifact: integration-functions
displayName: Publish Functions Artifact
- name: Build PDF Service
condition: >-
and(
ne(variables['Agent.JobStatus'], 'Failed'),
or(
and(
eq(variables['Build.Reason'], 'Manual'),
eq(${{ parameters.buildPdfApi }}, 'true')
),
and(
ne(variables['Build.Reason'], 'Manual'),
or(
eq(variables['Build.SourceBranchName'], 'main'),
eq(dependencies.run_linting_and_tests.outputs['check_files.pdf-api'], 'true')
)
)
)
)
dependsOn:
- Run Linting & Tests
steps:
- template: ../steps/azure_web_app_docker_build_push.yml@templates
parameters:
azurecrName: $(azurecrName)
dockerfilePath: $(Build.Repository.LocalPath)/packages/pdf-service-api/Dockerfile
repository: appeal-planning-decision/pdf-service-api
buildArgs:
- GIT_SHA=$(Build.SourceVersion)
- name: Build Web
condition: >-
and(
ne(variables['Agent.JobStatus'], 'Failed'),
or(
and(
eq(variables['Build.Reason'], 'Manual'),
eq(${{ parameters.buildWeb }}, 'true')
),
and(
ne(variables['Build.Reason'], 'Manual'),
or(
eq(variables['Build.SourceBranchName'], 'main'),
eq(dependencies.run_linting_and_tests.outputs['check_files.business-rules'], 'true'),
eq(dependencies.run_linting_and_tests.outputs['check_files.common'], 'true'),
eq(dependencies.run_linting_and_tests.outputs['check_files.web'], 'true')
)
)
)
)
dependsOn:
- Run Linting & Tests
steps:
- template: ../steps/azure_web_app_docker_build_push.yml@templates
parameters:
azurecrName: $(azurecrName)
dockerfilePath: $(Build.Repository.LocalPath)/packages/forms-web-app/Dockerfile
repository: appeal-planning-decision/forms-web-app
buildArgs:
- GIT_SHA=$(Build.SourceVersion)