-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile_CNP
263 lines (236 loc) · 14.2 KB
/
Jenkinsfile_CNP
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
#!groovy
import uk.gov.hmcts.contino.AppPipelineConfig
import uk.gov.hmcts.contino.GithubAPI
@Library("Infrastructure")
String product = "finrem"
String component = "ccd-definitions"
AppPipelineConfig pipelineConf;
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)
def secrets = [
's2s-${env}' : [
secret('microservicekey-ccd-data', 'DATA_STORE_S2S_KEY'),
secret('microservicekey-ccd-definition', 'DEFINITION_STORE_S2S_KEY'),
secret('microservicekey-ccd-gw', 'API_GATEWAY_S2S_KEY'),
secret('microservicekey-ccd-ps', 'PRINT_S2S_KEY'),
secret('microservicekey-ccd-admin', 'ADMIN_S2S_KEY')
],
'ccd-${env}' : [
secret('ccd-api-gateway-oauth2-client-secret', 'API_GATEWAY_IDAM_SECRET'),
secret('ccd-admin-web-oauth2-client-secret', 'ADMIN_WEB_IDAM_SECRET'),
secret('postcode-info-address-lookup-token', 'ADDRESS_LOOKUP_TOKEN'),
secret('idam-data-store-client-secret','IDAM_OAUTH2_DATA_STORE_CLIENT_SECRET'),
secret('idam-data-store-system-user-username','IDAM_DATA_STORE_SYSTEM_USER_USERNAME'),
secret('idam-data-store-system-user-password','IDAM_DATA_STORE_SYSTEM_USER_PASSWORD'),
secret('AppInsightsInstrumentationKey', 'APP_INSIGHTS_INSTRUMENTATION_KEY')
],
'finrem-${env}' : [
secret('case-document-am-api-s2s-secret', 'CASE_DOCUMENT_AM_API_S2S_SECRET'),
secret('fixedlists-consented-judgedetails-1', 'FIXEDLISTS_CONSENTED_JUDGEDETAILS_1'),
secret('fixedlists-consented-judgedetails-2', 'FIXEDLISTS_CONSENTED_JUDGEDETAILS_2'),
secret('fixedlists-consented-judgedetails-3', 'FIXEDLISTS_CONSENTED_JUDGEDETAILS_3'),
secret('fixedlists-consented-judgedetails-4', 'FIXEDLISTS_CONSENTED_JUDGEDETAILS_4'),
secret('fixedlists-consented-judgedetails-5', 'FIXEDLISTS_CONSENTED_JUDGEDETAILS_5'),
secret('fixedlists-consented-judgedetails-6', 'FIXEDLISTS_CONSENTED_JUDGEDETAILS_6'),
secret('fixedlists-consented-judgedetails-7', 'FIXEDLISTS_CONSENTED_JUDGEDETAILS_7'),
secret('fixedlists-consented-judgedetails-8', 'FIXEDLISTS_CONSENTED_JUDGEDETAILS_8'),
secret('fixedlists-consented-judgedetails-9', 'FIXEDLISTS_CONSENTED_JUDGEDETAILS_9'),
secret('userprofile-consented-judgedetails-1', 'USERPROFILE_CONSENTED_JUDGEDETAILS_1'),
secret('userprofile-consented-judgedetails-2', 'USERPROFILE_CONSENTED_JUDGEDETAILS_2'),
secret('userprofile-consented-judgedetails-3', 'USERPROFILE_CONSENTED_JUDGEDETAILS_3'),
secret('userprofile-consented-judgedetails-4', 'USERPROFILE_CONSENTED_JUDGEDETAILS_4'),
secret('userprofile-consented-judgedetails-5', 'USERPROFILE_CONSENTED_JUDGEDETAILS_5'),
secret('userprofile-consented-judgedetails-6', 'USERPROFILE_CONSENTED_JUDGEDETAILS_6'),
secret('userprofile-consented-judgedetails-7', 'USERPROFILE_CONSENTED_JUDGEDETAILS_7'),
secret('userprofile-consented-judgedetails-8', 'USERPROFILE_CONSENTED_JUDGEDETAILS_8'),
secret('userprofile-consented-judgedetails-9', 'USERPROFILE_CONSENTED_JUDGEDETAILS_9'),
secret('userprofile-contested-judgedetails', 'USERPROFILE_CONTESTED_JUDGEDETAILS'),
secret('username-solicitor', 'USERNAME_SOLICITOR'),
secret('password-solicitor', 'PASSWORD_SOLICITOR'),
secret('username-caseworker', 'USERNAME_CASEWORKER'),
secret('password-caseworker', 'PASSWORD_CASEWORKER'),
secret('fr-judge-username','USERNAME_JUDGE'),
secret('fr-judge-password', 'PASSWORD_JUDGE'),
secret('idam-client-secret', 'IDAM_CLIENT_SECRET'),
secret('ccd-submission-s2s-auth-secret', 'CCD_SUBMIT_S2S_SECRET'),
secret('ccd-admin-username', 'CCD_ADMIN_USER_NAME'),
secret('ccd-admin-password', 'CCD_ADMIN_PASSWORD'),
secret('finrem-doc-s2s-auth-secret', 'FINREM_DOC_GEN_SERVICE_S2S_KEY'),
secret('docmosis-api-key', 'PDF_SERVICE_ACCESS_KEY'),
secret('finrem-case-orchestration-service-s2s-key', 'FINREM_CASE_ORCHESTRATION_SERVICE_S2S_KEY'),
secret('docmosis-endpoint', 'PDF_SERVICE_BASEURL'),
secret('gov-uk-notification-key', 'UK_GOV_NOTIFY_API_KEY'),
secret('finrem-payment-service-s2s-key', 'FINREM_PAYMENTS_SERVICE_S2S_KEY'),
secret('idam-caa-username', 'IDAM_CAA_USERNAME'),
secret('idam-caa-password', 'IDAM_CAA_PASSWORD'),
secret('manage-case-s2s-key', 'MANAGE_CASE_S2S_KEY'),
secret('idam-noc-approver-username', 'IDAM_NOC_APPROVER_USERNAME'),
secret('idam-noc-approver-password', 'IDAM_NOC_APPROVER_PASSWORD'),
secret('notify-mca-api-key', 'NOTIFY_MCA_API_KEY'),
secret('finrem-system-update-username', 'FINREM_SYSTEMUPDATE_USERNAME'),
secret('finrem-system-update-password', 'FINREM_SYSTEMUPDATE_PASSWORD'),
secret('idam-mca-client-secret', 'IDAM_MCA_CLIENT_SECRET'),
secret('finrem-idam-client-secret', 'FINREM_IDAM_CLIENT_SECRET'),
secret('solicitor1-username', 'USERNAME_SOLICITOR1'),
secret('solicitor1-password', 'PASSWORD_SOLICITOR1'),
secret('barrister1-username', 'USERNAME_BARRISTER1'),
secret('barrister1-password', 'PASSWORD_BARRISTER1'),
secret('username-caa', 'USERNAME_CAA'),
secret('password-caa', 'PASSWORD_CAA'),
secret('username-respondent-solicitor', 'USERNAME_RESPONDENT_SOLICITOR'),
secret('playwright-solicitor-username', 'PLAYWRIGHT_SOLICITOR_USERNAME'),
secret('playwright-solicitor-password', 'PLAYWRIGHT_SOLICITOR_PSWD'),
secret('playwright-respondent-sol-username', 'PLAYWRIGHT_RESPONDENT_SOL_USERNAME'),
secret('playwright-respondent-sol-password', 'PLAYWRIGHT_RESPONDENT_SOL_PSWD'),
secret('playwright-respondent-caa-username', 'PLAYWRIGHT_RESP_CAA_USERNAME'),
secret('playwright-respondent-caa-password', 'PLAYWRIGHT_RESP_CAA_PSWD'),
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[ $class: 'AzureKeyVaultSecret',
secretType: 'Secret',
name: secretName,
version: '',
envVariable: envVar
]
}
def getFinremCosImage() {
def githubApi = new GithubAPI(this)
for (label in githubApi.getLabelsbyPattern(env.BRANCH_NAME, "use-finrem-cos-pr-") ) {
return label.minus("use-finrem-cos-")
}
return "latest"
}
// Configure branches to sync with master branch
def branchesToSync = ['demo', 'ithc', 'perftest']
properties([
copyArtifactPermission('*'),
]);
withPipeline("nodejs", product, component) {
loadVaultSecrets(secrets)
enableHighLevelDataSetup()
syncBranchesWithMaster(branchesToSync)
pipelineConf = config
afterSuccess('test') {
// enable yarn audit and send message on master branch only
try {
yarnBuilder.yarn('npm audit')
} catch (error) {
onMaster {
slackSend(channel: '#finrem-dev', color: 'warning', message: "Yarn Audit has detected vulnerabilities in ${env.JOB_NAME}. You can check if there are patches for them in the full report, build details here: <${env.RUN_DISPLAY_URL}|Build ${env.BUILD_DISPLAY_NAME}>.")
}
}
}
before('highleveldatasetup') {
echo "CCD definition upload for environment: ${env.ENV}"
env.RUNNING_ENV = env.ENV;
yarnBuilder.yarn('setup')
if('preview' == env.ENV) {
env.RUNNING_ENV = "aat"
env.COS_API_URL = "http://finrem-ccd-definitions-pr-${CHANGE_ID}-finrem-cos"
env.AAC_API_URL = "https://aac-finrem-ccd-definitions-pr-${CHANGE_ID}.preview.platform.hmcts.net"
env.CCD_DATA_API_URL = "https://ccd-data-store-api-finrem-ccd-definitions-pr-${CHANGE_ID}.preview.platform.hmcts.net"
env.DEFINITION_STORE_URL_BASE = "https://ccd-definition-store-finrem-ccd-definitions-pr-${CHANGE_ID}.preview.platform.hmcts.net"
stageWithAgent('Generate Financial Remedy Consented Case config', product) {
yarnBuilder.yarn("generate-excel-preview-consented")
}
stageWithAgent('Generate Financial Remedy Contested Case config', product) {
yarnBuilder.yarn("generate-excel-preview-contested")
yarnBuilder.yarn("copy-preview-xlxs-to-resources")
}
env.CCD_ADMIN_URL = "https://admin-web-finrem-ccd-definitions-pr-${CHANGE_ID}.preview.platform.hmcts.net"
env.CCD_WEB_URL = "https://xui-finrem-ccd-definitions-pr-${CHANGE_ID}.preview.platform.hmcts.net"
env.XUI_ORG_WEB_URL = "https://xui-mo-finrem-ccd-definitions-pr-${CHANGE_ID}.preview.platform.hmcts.net"
env.CCD_CONSENTED_FILE_NAME = "ccd-config-preview-consented-${GIT_COMMIT}.xlsx"
env.CCD_CONTESTED_FILE_NAME = "ccd-config-preview-contested-${GIT_COMMIT}.xlsx"
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'definitions/**/xlsx/*.xlsx'
} else {
withSubscription(env.ENV != 'prod' ? 'nonprod' : 'prod') {
withTeamSecrets(pipelineConf, 'aat') {
stageWithAgent('Generate Financial Remedy Consented Case config', product) {
dir('definitions/consented/json/UserProfile') {
sh 'echo ${USERPROFILE_CONSENTED_JUDGEDETAILS_1} > UserProfile-judgeDetails1-prod.json'
sh 'echo ${USERPROFILE_CONSENTED_JUDGEDETAILS_2} > UserProfile-judgeDetails2-prod.json'
sh 'echo ${USERPROFILE_CONSENTED_JUDGEDETAILS_3} > UserProfile-judgeDetails3-prod.json'
sh 'echo ${USERPROFILE_CONSENTED_JUDGEDETAILS_4} > UserProfile-judgeDetails4-prod.json'
sh 'echo ${USERPROFILE_CONSENTED_JUDGEDETAILS_5} > UserProfile-judgeDetails5-prod.json'
sh 'echo ${USERPROFILE_CONSENTED_JUDGEDETAILS_6} > UserProfile-judgeDetails6-prod.json'
}
dir('definitions/consented/json/FixedLists') {
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_1} > FixedLists-judgeDetails1-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_2} > FixedLists-judgeDetails2-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_3} > FixedLists-judgeDetails3-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_4} > FixedLists-judgeDetails4-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_5} > FixedLists-judgeDetails5-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_6} > FixedLists-judgeDetails6-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_7} > FixedLists-judgeDetails7-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_8} > FixedLists-judgeDetails8-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_9} > FixedLists-judgeDetails9-prod.json'
}
yarnBuilder.yarn("generate-excel-${env.ENV}-consented")
}
stageWithAgent('Generate Financial Remedy Contested Case config', product) {
dir('definitions/contested/json/FixedLists') {
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_1} > FixedLists-judgeDetails1-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_2} > FixedLists-judgeDetails2-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_3} > FixedLists-judgeDetails3-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_4} > FixedLists-judgeDetails4-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_5} > FixedLists-judgeDetails5-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_6} > FixedLists-judgeDetails6-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_7} > FixedLists-judgeDetails7-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_8} > FixedLists-judgeDetails8-prod.json'
sh 'echo ${FIXEDLISTS_CONSENTED_JUDGEDETAILS_9} > FixedLists-judgeDetails9-prod.json'
}
yarnBuilder.yarn("generate-excel-${env.ENV}-contested")
yarnBuilder.yarn("copy-${env.ENV}-xlxs-to-resources")
}
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'definitions/**/xlsx/*.xlsx'
env.CCD_ADMIN_URL = "https://ccd-admin-web.${env.ENV}.platform.hmcts.net"
env.CCD_DATA_API_URL = "http://ccd-data-store-api-${env.ENV}.service.core-compute-aat.internal"
env.CCD_WEB_URL = "https://manage-case.${env.ENV}.platform.hmcts.net"
env.XUI_ORG_WEB_URL = "https://manage-org.${env.ENV}.platform.hmcts.net"
env.CCD_CONSENTED_FILE_NAME = "ccd-config-${env.ENV}-consented-${GIT_COMMIT}.xlsx"
env.CCD_CONTESTED_FILE_NAME = "ccd-config-${env.ENV}-contested-${GIT_COMMIT}.xlsx"
}
}
}
}
onMaster() {
env.ENV='aat'
}
onPR() {
env.ENV='preview'
env.FINREM_COS_IMAGE = getFinremCosImage()
}
onIthc() {
env.ENV='ithc'
}
onDemo() {
env.ENV='demo'
}
onPerftest() {
env.ENV='perftest'
}
before('smoketest:preview') {
sh 'yarn playwright install'
}
before('smoketest:aat') {
sh 'yarn playwright install'
}
before('functionalTest') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'definitions/**/xlsx/*.xlsx'
}
afterAlways('smokeTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/tests/smoke/**/*'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'test-results/**/trace.zip'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'test-results/**/*.png'
}
afterSuccess('functionalTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'test/functional/output/mochawesome.html'
}
afterSuccess('functionalTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'test/functional/output/mochawesome.html'
slackSend(channel: '#finrem-dev', color: 'warning', message: "Master config has been uploaded to AAT. Build details here: <${env.RUN_DISPLAY_URL}|Build ${env.BUILD_DISPLAY_NAME}>.")
env.ENV='prod'
}
}