-
Notifications
You must be signed in to change notification settings - Fork 1
362 lines (347 loc) · 14.5 KB
/
deploy.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
name: Deploy
run-name: Deploy to ${{ inputs.environment }}
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}-${{ inputs.environment }}"
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
environment:
description: The environment target for deployment
default: 'Development'
type: choice
options:
- 'Development'
- 'Test'
- 'Test2'
- 'Pre-production'
- 'Production'
permissions:
id-token: write
contents: read
jobs:
build-projects-upload-artifacts:
name: ${{ matrix.job_name }}
strategy:
fail-fast: true
matrix:
project: [ src/service/idam-api/,
src/service/notification-api/,
src/service/referral-api/,
src/service/report-api/,
src/service/service-directory-api/,
src/service/mock-hsda-api/,
src/function/open-referral-function/,
src/ui/connect-dashboard-ui/,
src/ui/connect-ui/,
src/ui/find-ui/,
src/ui/idam-maintenance-ui/,
src/ui/manage-ui/
]
include:
- project: src/service/idam-api/
publish_project: FamilyHubs.Idam.Api
job_name: Build - IDAM API
- project: src/service/notification-api/
publish_project: FamilyHubs.Notification.Api
job_name: Build - Notification API
- project: src/service/referral-api/
publish_project: FamilyHubs.Referral.Api
job_name: Build - Referral API
- project: src/service/report-api/
publish_project: FamilyHubs.Report.Api
job_name: Build - Report API
- project: src/service/service-directory-api/
publish_project: FamilyHubs.ServiceDirectory.Api
job_name: Build - Service Directory API
- project: src/service/mock-hsda-api/
publish_project: FamilyHubs.Mock-Hsda.Api
job_name: Build - Mock HSDA API
dotnet_version_override: "8.0.x"
- project: src/function/open-referral-function/
publish_project: FamilyHubs.OpenReferral.Function
job_name: Build - Open Referral Function
dotnet_version_override: "8.0.x"
- project: src/ui/connect-dashboard-ui/
publish_project: FamilyHubs.RequestForSupport.Web
job_name: Build - Connect Dashboard UI
- project: src/ui/connect-ui/
publish_project: FamilyHubs.Referral.Web
job_name: Build - Connect UI
- project: src/ui/find-ui/
publish_project: FamilyHubs.ServiceDirectory.Web
job_name: Build - Find UI
- project: src/ui/idam-maintenance-ui/
publish_project: FamilyHubs.Idams.Maintenance.UI
job_name: Build - IDAM Maintenance UI
- project: src/ui/manage-ui/
publish_project: FamilyHubs.ServiceDirectory.Admin.Web
job_name: Build - Manage UI
uses: ./.github/workflows/build-upload-artifact.yml
with:
project: ${{ matrix.project }}
publish_project: ${{ matrix.publish_project }}
dotnet_version: ${{ matrix.dotnet_version_override || vars.DOTNET_VERSION }}
reset-databases:
if: startsWith(inputs.environment, 'Test')
name: Reset the ${{ matrix.display_name }} database
needs: [ build-projects-upload-artifacts ]
strategy:
matrix:
databases: [
idam-database,
notification-database,
open-referral-mock-database,
referral-database,
report-database,
service-directory-database
]
include:
- databases: idam-database
display_name: IDAM
keyvault_secret_name: IDAM-API-CONNECTIONSTRINGS-IDAMCONNECTION
sql_file_path: ./test/reset-scripts/reset-database.sql
- databases: notification-database
display_name: Notification
keyvault_secret_name: NOTIFICATIONS-API-CONNECTIONSTRINGS-NOTIFICATIONCONNECTION
sql_file_path: ./test/reset-scripts/reset-database.sql
- databases: open-referral-mock-database
display_name: Open Referral Mock
keyvault_secret_name: MOCK-HSDA-API-CONNECTIONSTRINGS-HSDAMOCKRESPONSESCONNECTION
sql_file_path: ./test/reset-scripts/reset-database.sql
- databases: referral-database
display_name: Referral
keyvault_secret_name: REFERRAL-API-CONNECTIONSTRINGS-REFERRALCONNECTION
sql_file_path: ./test/reset-scripts/reset-database.sql
- databases: report-database
display_name: Report
keyvault_secret_name: REPORT-API-CONNECTIONSTRINGS-REPORTCONNECTION
sql_file_path: ./test/reset-scripts/reset-database.sql
- databases: service-directory-database
display_name: Service Directory
keyvault_secret_name: SD-API-CONNECTIONSTRINGS-SERVICEDIRECTORYCONNECTION
sql_file_path: ./test/reset-scripts/reset-database.sql
uses: ./.github/workflows/run-sql-script.yml
with:
environment: ${{ inputs.environment }}
display_name: ${{ matrix.display_name }}
keyvault_secret_name: ${{ matrix.keyvault_secret_name }}
sql_file_path: ${{ matrix.sql_file_path }}
secrets: inherit
deploy-api-services:
if: always() && (needs.reset-databases.result == 'success' || needs.reset-databases.result == 'skipped')
name: ${{ matrix.job_name }}
needs: [ reset-databases ]
strategy:
matrix:
artifact_name: [ idam-api,
notification-api,
referral-api,
report-api,
service-directory-api,
mock-hsda-api
]
include:
- artifact_name: idam-api
job_name: Deploy - IDAM API
keyvault_prefix: IDAM-API
project_name: FamilyHubs.Idam.Api
data_project_name: FamilyHubs.Idam.Data
database_context: ApplicationDbContext
azure_app_name: as-fh-idam-api
- artifact_name: notification-api
job_name: Deploy - Notification API
keyvault_prefix: NOTIFICATIONS-API
project_name: FamilyHubs.Notification.Api
data_project_name: FamilyHubs.Notification.Data
database_context: ApplicationDbContext
azure_app_name: as-fh-notification-api
- artifact_name: referral-api
job_name: Deploy - Referral API
keyvault_prefix: REFERRAL-API
project_name: FamilyHubs.Referral.Api
data_project_name: FamilyHubs.Referral.Data
database_context: ApplicationDbContext
azure_app_name: as-fh-referral-api
- artifact_name: report-api
job_name: Deploy - Report API
keyvault_prefix: REPORT-API
project_name: FamilyHubs.Report.Api
data_project_name: FamilyHubs.Report.Data
database_context: ReportDbContext
azure_app_name: as-fh-report-api
- artifact_name: service-directory-api
job_name: Deploy - Service Directory API
keyvault_prefix: SD-API
project_name: FamilyHubs.ServiceDirectory.Api
data_project_name: FamilyHubs.ServiceDirectory.Data
database_context: ApplicationDbContext
azure_app_name: as-fh-sd-api
- artifact_name: mock-hsda-api
job_name: Deploy - Mock HSDA API
keyvault_prefix: MOCK-HSDA-API
project_name: FamilyHubs.Mock-Hsda.Api
data_project_name: FamilyHubs.Mock-Hsda.Api
database_context: MockDbContext
azure_app_name: as-fh-open-referral-mock-api
uses: ./.github/workflows/deploy-service.yml
with:
environment: ${{ inputs.environment }}
artifact_name: ${{ matrix.artifact_name }}
keyvault_prefix: ${{ matrix.keyvault_prefix }}
project_name: ${{ matrix.project_name }}
data_project_name: ${{ matrix.data_project_name }}
database_context: ${{ matrix.database_context }}
project_type: service
azure_app_name: ${{ matrix.azure_app_name }}
secrets: inherit
deploy-ui-services:
if: always() && needs.deploy-api-services.result == 'success' && (needs.reset-databases.result == 'success' || needs.reset-databases.result == 'skipped')
name: ${{ matrix.job_name }}
needs: [ deploy-api-services ]
strategy:
matrix:
artifact_name: [ connect-dashboard-ui,
connect-ui,
find-ui,
idam-maintenance-ui,
manage-ui
]
include:
- artifact_name: connect-dashboard-ui
job_name: Deploy - Connect Dashboard UI
keyvault_prefix: CONNECT-DASHBOARD-UI
project_name: FamilyHubs.RequestForSupport.Web
azure_app_name: as-fh-ref-dash-ui
- artifact_name: connect-ui
job_name: Deploy - Connect UI
keyvault_prefix: CONNECT-UI
project_name: FamilyHubs.Referral.Web
azure_app_name: as-fh-referral-ui
- artifact_name: find-ui
job_name: Deploy - Find UI
keyvault_prefix: FIND-UI
project_name: FamilyHubs.ServiceDirectory.Web
azure_app_name: as-fh-sd-ui
- artifact_name: idam-maintenance-ui
job_name: Deploy - IDAM Maintenance UI
keyvault_prefix: IDAM-MAINTENANCE-UI
project_name: FamilyHubs.Idams.Maintenance.UI
azure_app_name: as-fh-idam-maintenance-ui
- artifact_name: manage-ui
job_name: Deploy - Manage UI
keyvault_prefix: MANAGE-UI
project_name: FamilyHubs.ServiceDirectory.Admin.Web
azure_app_name: as-fh-sd-admin-ui
uses: ./.github/workflows/deploy-service.yml
with:
environment: ${{ inputs.environment }}
artifact_name: ${{ matrix.artifact_name }}
keyvault_prefix: ${{ matrix.keyvault_prefix }}
project_name: ${{ matrix.project_name }}
project_type: ui
azure_app_name: ${{ matrix.azure_app_name }}
secrets: inherit
deploy-functions:
if: always() && (needs.reset-databases.result == 'success' || needs.reset-databases.result == 'skipped')
name: ${{ matrix.job_name }}
needs: [ reset-databases ]
strategy:
matrix:
artifact_name: [
open-referral-function
]
include:
- artifact_name: open-referral-function
job_name: Deploy - Open Referral Function
keyvault_prefix: OPEN-REFERRAL-FUNC
azure_app_name: fa-fh-open-referral
uses: ./.github/workflows/deploy-function.yml
with:
environment: ${{ inputs.environment }}
artifact_name: ${{ matrix.artifact_name }}
keyvault_prefix: ${{ matrix.keyvault_prefix }}
azure_app_name: ${{ matrix.azure_app_name }}
secrets: inherit
seed-databases:
if: startsWith(inputs.environment, 'Test')
name: Seed the ${{ matrix.display_name }} database
needs: [ deploy-api-services, deploy-ui-services, deploy-functions ]
strategy:
matrix:
databases: [
idam-database,
notification-database,
open-referral-mock-database,
referral-database,
report-database,
service-directory-database
]
include:
- databases: idam-database
display_name: IDAM
keyvault_secret_name: IDAM-API-CONNECTIONSTRINGS-IDAMCONNECTION
sql_file_path: ./test/seed-scripts/test/idam-data.sql
- databases: notification-database
display_name: Notification
keyvault_secret_name: NOTIFICATIONS-API-CONNECTIONSTRINGS-NOTIFICATIONCONNECTION
sql_file_path: ./test/seed-scripts/test/notification-data.sql
- databases: open-referral-mock-database
display_name: Open Referral Mock
keyvault_secret_name: MOCK-HSDA-API-CONNECTIONSTRINGS-HSDAMOCKRESPONSESCONNECTION
sql_file_path: ./test/seed-scripts/test/open-referral-mock-data.sql
- databases: referral-database
display_name: Referral
keyvault_secret_name: REFERRAL-API-CONNECTIONSTRINGS-REFERRALCONNECTION
sql_file_path: ./test/seed-scripts/test/referral-data.sql
- databases: report-database
display_name: Report
keyvault_secret_name: REPORT-API-CONNECTIONSTRINGS-REPORTCONNECTION
sql_file_path: ./test/seed-scripts/test/report-data.sql
- databases: service-directory-database
display_name: Service Directory
keyvault_secret_name: SD-API-CONNECTIONSTRINGS-SERVICEDIRECTORYCONNECTION
sql_file_path: ./test/seed-scripts/test/service-directory-data.sql
uses: ./.github/workflows/run-sql-script.yml
with:
environment: ${{ inputs.environment }}
display_name: ${{ matrix.display_name }}
keyvault_secret_name: ${{ matrix.keyvault_secret_name }}
sql_file_path: ${{ matrix.sql_file_path }}
secrets: inherit
run-api-acceptance-tests:
if: startsWith(inputs.environment, 'Test')
name: ${{ matrix.job_name }}
needs: [ seed-databases ]
strategy:
matrix:
project_name: [
report-api,
referral-api,
service-directory-api
]
include:
- project_name: report-api
job_name: Test - Report API
keyvault_prefix: TEST-REPORT-API
app_name: as-fh-report-api
test_project_name: FamilyHubs.Report.Api.AcceptanceTests
- project_name: referral-api
job_name: Test - Referral API
keyvault_prefix: TEST-REFERRAL-API
app_name: as-fh-referral-api
test_project_name: FamilyHubs.Referral.Api.AcceptanceTests
- project_name: service-directory-api
job_name: Test - Service Directory API
keyvault_prefix: TEST-SERVICE-DIRECTORY-API
app_name: as-fh-sd-api
test_project_name: FamilyHubs.ServiceDirectory.Api.AcceptanceTests
uses: ./.github/workflows/run-acceptance-tests.yml
with:
environment: ${{ inputs.environment }}
project_name: ${{ matrix.project_name }}
keyvault_prefix: ${{ matrix.keyvault_prefix }}
app_name: ${{ matrix.app_name }}
test_project_name: ${{ matrix.test_project_name }}
project_type: service
secrets: inherit