-
Notifications
You must be signed in to change notification settings - Fork 11
/
Jenkinsfile_CNP
113 lines (92 loc) · 3.7 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
#!groovy
@Library("Infrastructure")
import uk.gov.hmcts.contino.GithubAPI
String product = "cmc"
String component = "citizen-frontend"
def ccdDefBranch = "master"
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)
def checkForEnableHelmLabel(branch_name) {
return new GithubAPI(this).getLabelsbyPattern(branch_name, "enableHelm").contains("enableHelm")
}
def secrets = [
'cmc-${env}':
[
secret('citizen-oauth-client-secret', 'OAUTH_CLIENT_SECRET'),
secret('smoke-test-citizen-username', 'SMOKE_TEST_CITIZEN_USERNAME'),
secret('smoke-test-user-password', 'SMOKE_TEST_USER_PASSWORD'),
secret('ccd-importer-username', 'CCD_CONFIGURER_IMPORTER_USERNAME'),
secret('ccd-importer-password', 'CCD_CONFIGURER_IMPORTER_PASSWORD'),
],
'ccd-${env}': [
secret('ccd-data-s2s-secret', 'DATA_STORE_S2S_KEY'),
secret('ccd-definition-s2s-secret', 'DEFINITION_STORE_S2S_KEY'),
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('microservicekey-ccd-gw', 'CCD_API_GATEWAY_S2S_SECRET'),
secret('ccd-api-gateway-oauth2-client-secret', 'CCD_API_GATEWAY_IDAM_CLIENT_SECRET'),
secret('ccd-api-gateway-oauth2-client-secret', 'CCD_API_GATEWAY_OAUTH2_CLIENT_SECRET'),
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[ $class: 'AzureKeyVaultSecret',
secretType: 'Secret',
name: secretName,
version: '',
envVariable: envVar
]
}
// Vars needed for AKS testing - keep values in sync with: charts/cmc-citizen-frontend/...
// THESE WILL BE OVERWRITTEN IN ASE DEPLOYMENTS WITH TERRAFORM OUTPUTS.TF
// THESE CAN BE PICKED UP IN INTEGRATION-TEST CODE DIRECTLY
env.IDAM_URL = 'https://idam-api.aat.platform.hmcts.net'
env.CLAIM_STORE_URL = 'http://cmc-claim-store-aat.service.core-compute-aat.internal'
env.FEATURE_ADMISSIONS = 'true'
env.FEATURE_DIRECTIONS_QUESTIONNAIRE = 'true'
env.FEATURE_TESTING_SUPPORT = 'true'
env.FEATURE_INVERSION_OF_CONTROL = 'true'
env.FEATURE_PCQ = 'true'
env.FEATURE_BREATHING_SPACE = 'true'
env.CUI_DASHBOARD_REDIRECT = 'true'
// add any others needed to selective testing...
String notificationsChannel = '#cmc-tech-notification'
def branchesToSync = ['demo', 'perftest', 'ithc']
withPipeline("nodejs", product, component) {
afterSuccess('build') {
yarnBuilder.yarn('setup')
}
before('smoketest:preview'){
log.info env.TEST_URL
env.CLAIM_STORE_URL = "https://claim-store-cmc-citizen-frontend-pr-${CHANGE_ID}.preview.platform.hmcts.net"
env.CCD_DEFINITION_CLAIM_STORE_URL = "http://cmc-citizen-frontend-pr-${CHANGE_ID}-claim-store"
sh """
eval \$(./bin/variables/load-preview-env-variables.sh ${CHANGE_ID})
./bin/add-roles.sh
./bin/pull-latest-ccd-defintion.sh ${ccdDefBranch}
"""
}
before('functionalTest:preview'){
log.info env.TEST_URL
env.CLAIM_STORE_URL = "https://claim-store-cmc-citizen-frontend-pr-${CHANGE_ID}.preview.platform.hmcts.net"
env.CCD_DEFINITION_CLAIM_STORE_URL = "http://cmc-citizen-frontend-pr-${CHANGE_ID}-claim-store"
}
afterSuccess('test') {
onMaster {
yarnBuilder.yarn('tests:a11y')
}
}
enableAksStagingDeployment()
disableLegacyDeployment()
enableSlackNotifications(notificationsChannel)
syncBranchesWithMaster(branchesToSync)
onMaster {
env.ENVIRONMENT="aat"
loadVaultSecrets(secrets)
}
onPR {
env.ENVIRONMENT = "preview"
env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
loadVaultSecrets(secrets)
}
}