generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
253 lines (235 loc) · 8.46 KB
/
merge.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
name: Merge
on:
workflow_run:
workflows: [PR Closed]
types: [completed]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
codeql:
name: Semantic Code Analysis
runs-on: ubuntu-22.04
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: actions/checkout@v4
- name: Initialize
uses: github/codeql-action/init@v2
with:
debug: true
languages: java,javascript
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
# Build Java apps, JavaScript doesn't require
- name: Java Builds
run: |
cd backend
mvn --update-snapshots -P prod clean package -Dmaven.test.skip
cd ../oracle-api
mvn --update-snapshots package -Dmaven.test.skip
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
init-test:
name: TEST Init
environment: test
runs-on: ubuntu-22.04
steps:
- name: OpenShift Init
uses: bcgov-nr/action-deployer-openshift@v1.0.4
with:
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
file: common/openshift.init.yml
overwrite: false
parameters:
-p ZONE=test -p NAME=${{ github.event.repository.name }}
-p ORACLE_DB_USER=${{ secrets.DB_USER }}
-p ORACLE_DB_PASSWORD='${{ secrets.DB_PASSWORD }}'
-p FORESTCLIENTAPI_KEY='${{ secrets.FORESTCLIENTAPI_KEY }}'
-p AWS_KINESIS_STREAM='${{ secrets.AWS_KINESIS_STREAM }}'
-p AWS_KINESIS_ROLE_ARN='${{ secrets.AWS_KINESIS_ROLE_ARN }}'
-p AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}
-p AWS_ACCESS_KEY_SECRET='${{ secrets.AWS_ACCESS_KEY_SECRET }}'
deploy-test:
name: TEST Deployment
needs: [init-test]
environment: test
runs-on: ubuntu-22.04
strategy:
matrix:
name: [database, backend, fluentbit, frontend, oracle-api]
include:
- name: database
file: database/openshift.deploy.yml
overwrite: false
- name: backend
file: backend/openshift.deploy.yml
overwrite: true
verification_path: "actuator/health"
parameters:
-p BUILD=test
-p NR_SPAR_BACKEND_ENV_OPENSEARCH=test
- name: fluentbit
file: backend/openshift.fluentbit.yml
overwrite: true
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
parameters:
-p VITE_SPAR_BUILD_VERSION=snapshot-test
-p VITE_NRSPARWEBAPP_VERSION=test
-p VITE_KC_URL=https://test.loginproxy.gov.bc.ca/auth
-p VITE_KC_REALM=standard
-p VITE_KC_CLIENT_ID=seed-planning-test-4296
- name: oracle-api
file: oracle-api/openshift.deploy.yml
overwrite: true
verification_path: "actuator/health"
parameters:
-p NR_SPAR_ORACLE_API_VERSION=snapshot-test
-p SERVICE_NAME=dbq01.nrs.bcgov
steps:
- uses: bcgov-nr/action-deployer-openshift@v1.0.4
with:
file: ${{ matrix.file }}
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: ${{ matrix.overwrite }}
penetration_test: false
verification_path: "actuator/health"
parameters:
-p ZONE=test -p NAME=${{ github.event.repository.name }}
${{ matrix.parameters }}
# api-tests:
# name: Newman API tests runner
# needs:
# - deploy-test
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Install Node
# uses: actions/setup-node@v3
# with:
# node-version: 16
# - name: Install newman
# run: |
# npm install -g newman
# npm install -g newman-reporter-htmlextra
# - name: Make Directory for Test Results
# run: mkdir -p testArtifacts
# - name: Run Postman Collection
# run: |
# newman run test/postman/starting-api.postman_collection.json -e test/postman/starting-api.postman_environment.json \
# --env-var "releaseVer=test=${{ env.NR_SPAR_BACKEND_VERSION }}" \
# --env-var "authServer=${{ secrets.KEYCLOAK_SERVER_REALM }}" \
# --env-var "authClient=${{ secrets.KC_SERVICE_ACCOUNT_NAME }}" \
# --env-var "authClient=${{ secrets.KC_SERVICE_ACCOUNT_PASS }}" \
# --suppress-exit-code -r htmlextra --reporter-htmlextra-export testArtifacts/api-tests-report.html
# - name: Output the results
# uses: actions/upload-artifact@v3
# with:
# name: API test report
# path: testArtifacts
init-prod:
name: PROD Init
needs:
- deploy-test
environment: prod
runs-on: ubuntu-22.04
steps:
- name: OpenShift Init
uses: bcgov-nr/action-deployer-openshift@v1.0.4
with:
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
file: common/openshift.init.yml
overwrite: false
parameters:
-p ZONE=prod -p NAME=${{ github.event.repository.name }}
-p ORACLE_DB_USER=${{ secrets.DB_USER }}
-p ORACLE_DB_PASSWORD='${{ secrets.DB_PASSWORD }}'
-p FORESTCLIENTAPI_KEY='${{ secrets.FORESTCLIENTAPI_KEY }}'
-p AWS_KINESIS_STREAM='${{ secrets.AWS_KINESIS_STREAM }}'
-p AWS_KINESIS_ROLE_ARN='${{ secrets.AWS_KINESIS_ROLE_ARN }}'
-p AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}
-p AWS_ACCESS_KEY_SECRET='${{ secrets.AWS_ACCESS_KEY_SECRET }}'
deploy-prod:
name: PROD Deployment
needs:
- init-prod
environment: prod
runs-on: ubuntu-22.04
strategy:
matrix:
name: [database, backend, fluentbit, frontend, oracle-api]
include:
- name: database
file: database/openshift.deploy.yml
overwrite: false
- name: backend
file: backend/openshift.deploy.yml
overwrite: true
verification_path: "actuator/health"
parameters:
-p BUILD=prod
-p ORACLE_SERVER_URL=https://nr-spar-prod-oracle-api.apps.silver.devops.gov.bc.ca
-p NR_SPAR_BACKEND_ENV_OPENSEARCH=production
- name: fluentbit
file: backend/openshift.fluentbit.yml
overwrite: true
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
parameters:
-p VITE_SPAR_BUILD_VERSION=snapshot-prod
-p VITE_NRSPARWEBAPP_VERSION=prod
-p VITE_KC_URL=https://loginproxy.gov.bc.ca/auth
-p VITE_KC_REALM=standard
-p VITE_KC_CLIENT_ID=seed-planning-test-4296
-p VITE_ORACLE_SERVER_URL=https://nr-spar-prod-oracle-api.apps.silver.devops.gov.bc.ca
- name: oracle-api
file: oracle-api/openshift.deploy.yml
overwrite: true
verification_path: "actuator/health"
parameters:
-p NR_SPAR_ORACLE_API_VERSION=snapshot-prod
-p SERVICE_NAME=dbq01.nrs.bcgov
steps:
- uses: bcgov-nr/action-deployer-openshift@v1.0.4
with:
file: ${{ matrix.file }}
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: ${{ matrix.overwrite }}
penetration_test: false
verification_path: "actuator/health"
parameters:
-p ZONE=prod -p NAME=${{ github.event.repository.name }}
${{ matrix.parameters }}
image-promotions:
name: Promote Images to PROD
needs:
- deploy-prod
runs-on: ubuntu-22.04
strategy:
matrix:
component: [backend, database, frontend, oracle-api]
steps:
- uses: shrink/actions-docker-registry-tag@v3
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.component }}
target: test
tags: prod