-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.yml
252 lines (244 loc) · 6.81 KB
/
config.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
version: 2.1
orbs:
hmpps: ministryofjustice/hmpps@8.2
slack: circleci/slack@4.12.5
mem: circleci/rememborb@0.0.2
parameters:
alerts-slack-channel:
type: string
default: "hmpps-assessments-notifications"
node-version:
type: string
default: 22.13-browsers
executors:
e2e-executor:
machine:
image: ubuntu-2204:current
resource_class: medium
jobs:
build:
executor:
name: hmpps/node
tag: << pipeline.parameters.node-version >>
steps:
- checkout
- run:
name: Update npm
command: 'sudo npm install -g npm@latest'
- restore_cache:
keys:
- dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Install Dependencies
command: npm ci --no-audit
- save_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
paths:
- node_modules
- ~/.cache
- run:
name: Linter check
command: npm run lint
- run:
command: |
npm run clean
npm run build
- persist_to_workspace:
root: .
paths:
- node_modules
- assets/stylesheets
test:
executor:
name: hmpps/node
tag: << pipeline.parameters.node-version >>
steps:
- checkout
- restore_cache:
keys:
- dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: unit tests
command: npm run test
- store_test_results:
path: test-results
- store_artifacts:
path: test-results/unit-test-reports.html
e2e_test:
executor: e2e-executor
parallelism: 2
steps:
- checkout
- restore_cache:
keys:
- dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Move cached node_modules to project directory
command: mv ~/app/node_modules ~/project
- attach_workspace:
at: ~/app
- run:
name: Extract saved container image
command: docker load --input ~/app/docker_cache/build_image.tar
- mem/recall:
env_var: APP_VERSION
- run:
name: Stand up a test environment
command: |
export UI_IMAGE_TAG=$APP_VERSION
make test-up
- run:
name: Clear the visual regression diffs directory
command: rm -rf integration_tests/snapshots/diff
- run:
name: Run the end-to-end tests
command: make e2e-ci
- run:
name: Check for visual regression diffs
command: if test -d integration_tests/snapshots/diff; then exit 1; fi
- run:
name: Store container logs
command: make save-logs OUTPUT_LOGS_DIR=~/docker-logs PROJECT_NAME="community-payback-assessment-test"
when: on_fail
- store_test_results:
path: test_results
- store_artifacts:
path: integration_tests/videos
- store_artifacts:
path: integration_tests/screenshots
- store_artifacts:
path: integration_tests/snapshots/diff
- store_artifacts:
path: ~/docker-logs
workflows:
version: 2
build-test-and-deploy:
jobs:
- build:
filters:
tags:
ignore: /.*/
- test:
requires:
- build
- hmpps/helm_lint:
name: helm_lint_dev
env: development
- hmpps/helm_lint:
name: helm_lint_preprod
env: preprod
- hmpps/helm_lint:
name: helm_lint_prod
env: prod
- hmpps/build_docker:
name: build_docker
publish: false
persist_container_image: true
jira_update: true
pipeline_id: << pipeline.id >>
pipeline_number: << pipeline.number >>
context: hmpps-common-vars
- e2e_test:
context: hmpps-common-vars
requires:
- build
- build_docker
- hmpps/publish_docker:
name: publish_docker
publish_latest_tag: true
context: hmpps-common-vars
requires:
- test
- e2e_test
filters:
branches:
only:
- main
- hmpps/deploy_env:
name: deploy_dev
env: "development"
chart_name: hmpps-risk-assessment-ui
pipeline_id: << pipeline.id >>
pipeline_number: << pipeline.number >>
jira_update: true
context:
- hmpps-common-vars
filters:
branches:
only:
- main
requires:
- publish_docker
- helm_lint_dev
- helm_lint_preprod
- helm_lint_prod
- request-preprod-approval:
type: approval
requires:
- deploy_dev
- hmpps/deploy_env:
name: deploy_preprod
env: "preprod"
pipeline_id: << pipeline.id >>
pipeline_number: << pipeline.number >>
jira_update: true
context:
- hmpps-common-vars
- hmpps-assessments-preprod-live
requires:
- request-preprod-approval
- request-prod-approval:
type: approval
requires:
- deploy_preprod
- hmpps/deploy_env:
name: deploy_prod
env: "prod"
pipeline_id: << pipeline.id >>
pipeline_number: << pipeline.number >>
jira_update: true
context:
- hmpps-common-vars
- hmpps-assessments-prod-live
requires:
- request-prod-approval
security:
triggers:
- schedule:
cron: "7 6 * * 1-5"
filters:
branches:
only:
- main
jobs:
- hmpps/npm_outdated:
slack_channel: << pipeline.parameters.alerts-slack-channel >>
context:
- hmpps-common-vars
- hmpps/npm_security_audit:
slack_channel: << pipeline.parameters.alerts-slack-channel >>
context:
- hmpps-common-vars
- hmpps/trivy_latest_scan:
slack_channel: << pipeline.parameters.alerts-slack-channel >>
context:
- hmpps-common-vars
- hmpps/veracode_pipeline_scan:
slack_channel: << pipeline.parameters.alerts-slack-channel >>
context:
- veracode-credentials
- hmpps-common-vars
security-weekly:
triggers:
- schedule:
cron: "50 5 * * 1"
filters:
branches:
only:
- main
jobs:
- hmpps/veracode_policy_scan:
slack_channel: << pipeline.parameters.alerts-slack-channel >>
context:
- veracode-credentials
- hmpps-common-vars