-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile_CNP
212 lines (190 loc) · 11.9 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
#!groovy
properties([
[$class: 'GithubProjectProperty', projectUrlStr: 'https://github.com/hmcts/ia-case-api.git'],
pipelineTriggers([[$class: 'GitHubPushTrigger']])
])
@Library('Infrastructure')
import uk.gov.hmcts.contino.AppPipelineDsl
import uk.gov.hmcts.contino.GithubAPI
def type = "java"
def product = "ia"
def component = "case-api"
def dmnBranch = "master"
def bpmnBranch = "master"
def secrets = [
'rpx-${env}': [
secret('mc-s2s-client-secret', 'S2S_SECRET'),
secret('mc-idam-client-secret', 'IDAM_SECRET'),
secret('system-user-name', 'SYSTEM_USER_NAME'),
secret('system-user-password', 'SYSTEM_USER_PASSWORD'),
],
'ia-${env}' : [
secret('test-caseofficer-username', 'TEST_CASEOFFICER_USERNAME'),
secret('test-caseofficer-password', 'TEST_CASEOFFICER_PASSWORD'),
secret('test-law-firm-a-username', 'TEST_LAW_FIRM_A_USERNAME'),
secret('test-law-firm-a-password', 'TEST_LAW_FIRM_A_PASSWORD'),
secret('test-adminofficer-username', 'TEST_ADMINOFFICER_USERNAME'),
secret('test-adminofficer-password', 'TEST_ADMINOFFICER_PASSWORD'),
secret('test-homeoffice-apc-username', 'TEST_HOMEOFFICE_APC_USERNAME'),
secret('test-homeoffice-apc-password', 'TEST_HOMEOFFICE_APC_PASSWORD'),
secret('test-homeoffice-lart-username', 'TEST_HOMEOFFICE_LART_USERNAME'),
secret('test-homeoffice-lart-password', 'TEST_HOMEOFFICE_LART_PASSWORD'),
secret('test-homeoffice-pou-username', 'TEST_HOMEOFFICE_POU_USERNAME'),
secret('test-homeoffice-pou-password', 'TEST_HOMEOFFICE_POU_PASSWORD'),
secret('test-homeoffice-generic-username', 'TEST_HOMEOFFICE_GENERIC_USERNAME'),
secret('test-homeoffice-generic-password', 'TEST_HOMEOFFICE_GENERIC_PASSWORD'),
secret('test-judge-x-username', 'TEST_JUDGE_X_USERNAME'),
secret('test-judge-x-password', 'TEST_JUDGE_X_PASSWORD'),
secret('test-law-firm-share-case-a-username', 'TEST_LAW_FIRM_SHARE_CASE_A_USERNAME'),
secret('test-law-firm-share-case-a-password', 'TEST_LAW_FIRM_SHARE_CASE_A_PASSWORD'),
secret('test-citizen-username', 'TEST_CITIZEN_USERNAME'),
secret('test-citizen-password', 'TEST_CITIZEN_PASSWORD'),
secret('test-law-firm-share-case-a-username', 'TEST_LAW_FIRM_ORG_SUCCESS_USERNAME'),
secret('test-law-firm-share-case-a-password', 'TEST_LAW_FIRM_ORG_SUCCESS_PASSWORD'),
secret('test-law-firm-org-success-username', 'TEST_LAW_FIRM_ORG_SUCCESS_USERNAME'),
secret('test-law-firm-org-success-password', 'TEST_LAW_FIRM_ORG_SUCCESS_PASSWORD'),
secret('test-law-firm-org-deleted-username', 'TEST_LAW_FIRM_ORG_DELETED_USERNAME'),
secret('test-law-firm-org-deleted-password', 'TEST_LAW_FIRM_ORG_DELETED_PASSWORD'),
secret('wa-test-adminofficer-username', 'IA_WA_ADMINOFFICER_USERNAME'),
secret('wa-test-adminofficer-password', 'IA_WA_ADMINOFFICER_PASSWORD'),
secret('wa-test-caseofficer-a-username', 'IA_WA_CASEOFFICER_USERNAME'),
secret('wa-test-caseofficer-a-password', 'IA_WA_CASEOFFICER_PASSWORD'),
secret('wa-test-ctsc-admin-username', 'IA_WA_CTSC_ADMIN_USERNAME'),
secret('wa-test-ctsc-admin-password', 'IA_WA_CTSC_ADMIN_PASSWORD'),
secret('wa-test-adminofficer-username-1', 'IA_WA_ADMINOFFICER_USERNAME_1'),
secret('wa-test-adminofficer-password-1', 'IA_WA_ADMINOFFICER_PASSWORD_1'),
secret('wa-test-caseofficer-stcw-username', 'IA_WA_CASEOFFICER_USERNAME_STCW'),
secret('wa-test-caseofficer-stcw-password', 'IA_WA_CASEOFFICER_PASSWORD_STCW'),
secret('wa-test-judge-username', 'IA_WA_JUDGE_USERNAME'),
secret('wa-test-judge-password', 'IA_WA_JUDGE_PASSWORD'),
secret('wa-test-ctsc-admin-username-2', 'IA_WA_CTSC_ADMIN_USERNAME_2'),
secret('wa-test-ctsc-admin-password-2', 'IA_WA_CTSC_ADMIN_PASSWORD_2'),
secret('addressLookupToken', 'ADDRESS_LOOKUP_TOKEN'),
secret('pcq-token-key', 'PCQ_TOKEN_KEY'),
secret('ia-redis-access-key', 'IA_REDIS_ACCESS_KEY'),
secret('ia-redis-connection-string', 'IA_REDIS_CONNECTION_STRING'),
secret('homeoffice-client-id', 'IA_HOMEOFFICE_CLIENT_ID'),
secret('homeoffice-secret', 'IA_HOMEOFFICE_SECRET'),
secret('idam-client-id', 'IA_IDAM_CLIENT_ID'),
secret('idam-secret', 'IA_IDAM_SECRET'),
secret('s2s-secret', 'IA_S2S_SECRET'),
secret('s2s-microservice', 'IA_S2S_MICROSERVICE'),
secret('prof-ref-data-url', 'PROF_REF_DATA_URL'),
secret('docmosis-enabled', 'IA_DOCMOSIS_ENABLED'),
secret('docmosis-access-key', 'DOCMOSIS_ACCESS_KEY'),
secret('em-stitching-enabled', 'IA_EM_STITCHING_ENABLED'),
secret('submit-hearing-requirements-enabled', 'IA_SUBMIT_HEARING_REQUIREMENTS_ENABLED'),
secret('launch-darkly-sdk-key', 'LAUNCH_DARKLY_SDK_KEY'),
secret('app-insights-connection-string', 'app-insights-connection-string'),
secret('postgres-auth-values-password', 'PG_AUTH_VALUES_YAML_PASS'),
secret('generic-values-preview-password', 'GENERIC_VALUES_PREVIEW_YAML_PASS'),
secret('generic-docker-pact-broker-password', 'GENERIC_DOCKER_PACT_BROKER_YAML_PASS'),
secret('postgres-auth-values-tes-password', 'POSTGRES_AUTH_VALUES_TES_PASSWORD'),
secret('hearing-centre-activation-date-bradford', 'IA_HEARING_CENTRE_ACTIVATION_DATE_BRADFORD'),
secret('hearing-centre-activation-date-manchester', 'IA_HEARING_CENTRE_ACTIVATION_DATE_MANCHESTER'),
secret('hearing-centre-activation-date-newport', 'IA_HEARING_CENTRE_ACTIVATION_DATE_NEWPORT'),
secret('hearing-centre-activation-date-taylor-house', 'IA_HEARING_CENTRE_ACTIVATION_DATE_TAYLOR_HOUSE'),
secret('hearing-centre-activation-date-north-shields', 'IA_HEARING_CENTRE_ACTIVATION_DATE_NORTH_SHIELDS'),
secret('hearing-centre-activation-date-birmingham', 'IA_HEARING_CENTRE_ACTIVATION_DATE_BIRMINGHAM'),
secret('hearing-centre-activation-date-hatton-cross', 'IA_HEARING_CENTRE_ACTIVATION_DATE_HATTON_CROSS'),
secret('hearing-centre-activation-date-glasgow', 'IA_HEARING_CENTRE_ACTIVATION_DATE_GLASGOW'),
secret('servicesatcdmiac-password', 'CCD_UPLOAD_PASSWORD'),
secret('ccd-client-secret', 'CCD_CLIENT_SECRET')
],
'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-admin', 'ADMIN_S2S_KEY'),
secret('microservicekey-iac', 'IAC_S2S_KEY')
],
'ccd-${env}': [
secret('ccd-api-gateway-oauth2-client-secret', 'CCD_API_GATEWAY_IDAM_CLIENT_SECRET'),
secret('ccd-admin-web-oauth2-client-secret', 'ADMIN_WEB_IDAM_SECRET'),
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('postcode-info-address-lookup-token', 'ADDRESS_LOOKUP_TOKEN')
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
version : '',
envVariable: envVar
]
}
withPipeline(type, product, component) {
def githubApi = new GithubAPI(this)
env.ENABLE_WA = false
env.ENABLE_TES = false
for (label in githubApi.getLabelsbyPattern(env.BRANCH_NAME, "enable_") ) {
if (label == "enable_wa") {
env.ENABLE_WA = true
} else if (label == "enable_timed_event_service") {
env.ENABLE_TES = true
}
}
env.IA_CASE_DOCUMENTS_API_URL = "http://ia-case-documents-api-aat.service.core-compute-aat.internal/"
env.IA_CASE_NOTIFICATIONS_API_URL = "http://ia-case-notifications-api-aat.service.core-compute-aat.internal/"
env.IA_TIMED_EVENT_SERVICE_URL = "http://ia-timed-event-service-aat.service.core-compute-aat.internal/"
env.IA_CASE_PAYMENTS_API_URL = "http://ia-case-payments-api-aat.service.core-compute-aat.internal/"
env.IA_HOME_OFFICE_INTEGRATION_API_URL = "http://ia-home-office-integration-api-aat.service.core-compute-aat.internal/"
env.IA_IDAM_REDIRECT_URI = "https://ia-case-api-aat.service.core-compute-aat.internal/oauth2/callback"
env.CCD_URL = "http://ccd-data-store-api-aat.service.core-compute-aat.internal"
env.CCD_GW_URL = "http://dm-store-aat.service.core-compute-aat.internal"
env.DM_URL = "http://dm-store-aat.service.core-compute-aat.internal"
env.IDAM_URL = "https://idam-api.aat.platform.hmcts.net"
env.OPEN_ID_IDAM_URL = "https://idam-web-public.aat.platform.hmcts.net"
env.S2S_URL = "http://rpe-service-auth-provider-aat.service.core-compute-aat.internal"
env.PACT_BROKER_FULL_URL = "https://pact-broker.platform.hmcts.net"
env.ROLE_ASSIGNMENT_URL = "http://am-role-assignment-service-aat.service.core-compute-aat.internal"
env.CASE_DOCUMENT_AM_URL = "http://ccd-case-document-am-api-aat.service.core-compute-aat.internal"
env.IS_SAVE_AND_CONTINUE_ENABLED = "false"
env.IA_HOME_OFFICE_INTEGRATION_ENABLED = "true"
env.CASE_API_URL = "http://ia-case-api-demo.service.core-compute-demo.internal"
env.LOCATION_REF_DATA_URL = "http://rd-location-ref-api-aat.service.core-compute-aat.internal"
enableAksStagingDeployment()
disableLegacyDeployment()
loadVaultSecrets(secrets)
before('smoketest:preview') {
sh """
eval \$(./bin/variables/load-preview-environment-variables.sh ${CHANGE_ID})
./bin/add-roles.sh
"""
}
afterSuccess('akschartsinstall') {
onPR {
if (env.ENABLE_WA == true) {
githubUpdateDeploymentStatus(githubCreateDeployment("-AIP"), "https://ia-case-api-pr-${CHANGE_ID}-aip-frontend.preview.platform.hmcts.net")
githubUpdateDeploymentStatus(githubCreateDeployment("-LR"), "https://xui-ia-case-api-pr-${CHANGE_ID}." + "preview.platform.hmcts.net")
env.IDAM_API_URL = "https://idam-api.aat.platform.hmcts.net"
env.CAMUNDA_BASE_URL = "https://camunda-ia-case-api-pr-${CHANGE_ID}.preview.platform.hmcts.net"
env.SERVICE_AUTH_PROVIDER_API_BASE_URL = "http://rpe-service-auth-provider-aat.service.core-compute-aat.internal"
sh """
./bin/pull-latest-dmn-files.sh ${dmnBranch}
./bin/pull-latest-camunda-wa-files.sh ${bpmnBranch}
"""
}
}
}
afterAlways('functionalTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
env.IDAM_API_URL = "https://idam-api.aat.platform.hmcts.net"
env.ROLE_ASSIGNMENT_URL = "https://am-role-assignment-ia-case-api-pr-${CHANGE_ID}.preview.platform.hmcts.net"
sh """
./bin/add-org-roles-to-users.sh
"""
}
afterAlways('functionalTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
}
enableSlackNotifications('#ia-tech')
onMaster() {
enablePactAs([AppPipelineDsl.PactRoles.CONSUMER])
}
onPR() {
enablePactAs([AppPipelineDsl.PactRoles.CONSUMER])
}
}