-
Notifications
You must be signed in to change notification settings - Fork 9
343 lines (291 loc) · 12.2 KB
/
deployment.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
name: Deployment
on:
pull_request:
branches:
- main
jobs:
prepare-dev-database:
name: Prepare Dev Database
runs-on: ubuntu-24.04
steps:
- name: Set Variables
shell: bash
run: |
echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4.14"
- name: Deploy PostGIS instance
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
EPHEMERAL_STORAGE=True BUCKET=gpdqha DATA_SIZE=5Gi WAL_SIZE=5Gi bash openshift/scripts/oc_provision_crunchy.sh ${SUFFIX} apply
build-web-image:
# Declared ahead of build-api-image ; it runs slightly slower than the api build, and putting
# it here increases the odds that it get's started 1st, so api and web are slightly more likely
# to finish building at the same time.
name: Build Web Image
runs-on: ubuntu-24.04
steps:
- name: Set Variables
shell: bash
run: |
echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4.14"
- name: Build wps-web Image
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_TOOL_TOKEN }}"
GIT_BRANCH=${GITHUB_HEAD_REF} MODULE_NAME=web DOCKER_FILE=Dockerfile.web PATH_BC=openshift/templates/build.web.bc.yaml SENTRY_AUTH_TOKEN="${{ secrets.SENTRY_AUTH_TOKEN }}" bash openshift/scripts/oc_build.sh ${SUFFIX} apply
build-api-image:
name: Build API Image
runs-on: ubuntu-24.04
steps:
- name: Set Variables
shell: bash
run: |
echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4.14"
- name: Build wps-api Image
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_TOOL_TOKEN }}"
GIT_BRANCH=${GITHUB_HEAD_REF} MODULE_NAME=api bash openshift/scripts/oc_build.sh ${SUFFIX} apply
# TODO: Delete once pmtiles has run for some time
# build-tileserv-image:
# name: Build tileserv Image
# runs-on: ubuntu-22.04
# steps:
# - name: Set Variables
# shell: bash
# run: |
# echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
# - name: Checkout
# uses: actions/checkout@v4
# - name: Build wps-tileserv Image
# shell: bash
# run: |
# oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_TOOL_TOKEN }}"
# GIT_BRANCH=${GITHUB_HEAD_REF} MODULE_NAME=tileserv DOCKER_FILE=Dockerfile.tileserv PATH_BC=openshift/templates/tileserv/tileserv_build.yaml bash openshift/scripts/oc_build.sh ${SUFFIX} apply
configure-nats-server-name:
name: Configure nats server name
runs-on: ubuntu-24.04
steps:
- name: Set Variables
shell: bash
run: |
echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4.14"
- name: Configure
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
bash openshift/scripts/oc_provision_nats_server_config.sh ${SUFFIX} apply
deploy-dev:
name: Deploy to Dev
if: github.triggering_actor != 'renovate'
needs:
[
build-api-image,
build-web-image,
prepare-dev-database,
deploy-dev-queue,
configure-nats-server-name,
]
runs-on: ubuntu-24.04
steps:
- name: Set Variables
shell: bash
run: |
echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4.14"
- name: Deploy API to Dev
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
MODULE_NAME=api SECOND_LEVEL_DOMAIN="apps.silver.devops.gov.bc.ca" VANITY_DOMAIN="${SUFFIX}-dev-psu.apps.silver.devops.gov.bc.ca" ENVIRONMENT="development" bash openshift/scripts/oc_deploy.sh ${SUFFIX} apply
## TODO: re-enable once crunchy is deployed: https://app.zenhub.com/workspaces/bcws---agile-psu-5e321393e038fba5bbe203b8/issues/gh/bcgov/wps/2340
- name: Hourly actuals cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
bash openshift/scripts/oc_provision_wfwx_hourly_actuals_cronjob.sh ${SUFFIX} apply
# - name: Noon forecasts cronjob
# shell: bash
# run: |
# oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
# bash openshift/scripts/oc_provision_wfwx_noon_forecasts_cronjob.sh ${SUFFIX} apply
- name: Environment Canada GDPS cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_ec_gdps_cronjob.sh ${SUFFIX} apply
- name: Environment Canada HRDPS cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_ec_hrdps_cronjob.sh ${SUFFIX} apply
# - name: Environment Canada RDPS cronjob
# shell: bash
# run: |
# oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
# PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_ec_rdps_cronjob.sh ${SUFFIX} apply
- name: NOAA GFS cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_noaa_gfs_cronjob.sh ${SUFFIX} apply
- name: NOAA NAM cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_noaa_nam_cronjob.sh ${SUFFIX} apply
- name: VIIRS SNOW cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_viirs_snow_cronjob.sh ${SUFFIX} apply
- name: GRASS CURING cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_grass_curing_cronjob.sh ${SUFFIX} apply
- name: RDPS SFMS cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_rdps_sfms_cronjob.sh ${SUFFIX} apply
- name: SFMS Raster Calculations cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_sfms_calculations_cronjob.sh ${SUFFIX} apply
- name: Hourly pruner nightly cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_hourly_prune_cronjob.sh ${SUFFIX} apply
- name: Partitioner cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_DEV="e1e498-dev" SCHEDULE="0 0 1 * *" bash openshift/scripts/oc_provision_partitioner_cronjob.sh ${SUFFIX} apply
# TODO: Delete once pmtiles has run for some time
# deploy-tileserv:
# name: Deploy tileserv to Dev
# if: github.triggering_actor != 'renovate'
# runs-on: ubuntu-22.04
# # We need
# # - the image to be built before we can deploy.
# needs: [build-tileserv-image]
# steps:
# - name: Set Variables
# shell: bash
# run: |
# echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
# - name: Checkout
# uses: actions/checkout@v3
# - name: Tileserv
# shell: bash
# run: |
# oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
# PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_tileserv.sh ${SUFFIX} apply
deploy-dev-queue:
name: Deploy Message Queue to Dev
if: github.triggering_actor != 'renovate'
runs-on: ubuntu-24.04
# We need
# - the image to be built before we can deploy.
# - we need the tileserv database up so we can write to it
needs: [build-api-image, configure-nats-server-name]
steps:
- name: Set Variables
shell: bash
run: |
echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4.14"
- name: NATS Message Queue
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_DEV="e1e498-dev" MEMORY_REQUEST=250Mi MEMORY_LIMIT=500Mi bash openshift/scripts/oc_provision_nats.sh ${SUFFIX} apply
scan-dev:
name: ZAP Baseline Scan Dev
needs: [deploy-dev]
runs-on: ubuntu-24.04
steps:
# f.y.i.: ZAP Scan must be able to log an issue or it will fail.
- name: ZAP Scan
uses: zaproxy/[email protected]
with:
target: "https://wps-pr-${{ github.event.number }}-e1e498-dev.apps.silver.devops.gov.bc.ca"
rules_file_name: ".zap/rules.tsv"
# Do not return failure on warnings - TODO: this has to be resolved!
cmd_options: "-I"
run-schemathesis:
name: Schemathesis Fuzzing
if: github.triggering_actor != 'renovate'
runs-on: ubuntu-24.04
needs: [deploy-dev]
steps:
- name: Run Schemathesis
continue-on-error: true
uses: schemathesis/action@v1
with:
# Your API schema location
schema: "https://wps-pr-${{ github.event.number }}.apps.silver.devops.gov.bc.ca/api/openapi.json"
args: "--experimental=openapi-3.1"
# Set your token from secrets
token: ${{ secrets.SCHEMATHESIS_TOKEN }}
deploy-c-haines:
name: Deploy c-haines cronjob
if: github.triggering_actor != 'renovate'
runs-on: ubuntu-24.04
# We need
# - the image to be built before we can deploy.
# - the database to be there (so we can write to it).
# - wait for the api deployment, as it's responsible for upgrading the database.
needs: [build-api-image, prepare-dev-database, deploy-dev]
steps:
- name: Set Variables
shell: bash
run: echo "SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4.14"
- name: C-Haines Cronjob
shell: bash
run: |
oc login "${{ secrets.OPENSHIFT_CLUSTER }}" --token="${{ secrets.OC4_DEV_TOKEN }}"
PROJ_TARGET="e1e498-dev" PROJ_TOOLS="e1e498-tools" PROJ_DEV="e1e498-dev" bash openshift/scripts/oc_provision_c_haines_cronjob.sh ${SUFFIX} apply