-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathJenkinsfile_CNP
76 lines (61 loc) · 2.04 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
#!groovy
@Library("Infrastructure")
String product = "div"
String component = "pfe"
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)
def secrets = [
'div-${env}': [
secret('session-secret', 'SECRET'),
secret('redis-secret', 'SESSION_ENCRYPTION_SECRET'),
secret('idam-secret', 'IDAM_SECRET'),
secret('os-places-token', 'POST_CODE_ACCESS_TOKEN'),
secret('frontend-secret', 'MICROSERVICE_KEY'),
secret('launchdarkly-key', 'LAUNCHDARKLY_KEY'),
secret('idam-citizen-username', 'IDAM_CITIZEN_EMAIL'),
secret('idam-citizen-password', 'IDAM_CITIZEN_PASSWORD')
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[ $class: 'AzureKeyVaultSecret',
secretType: 'Secret',
name: secretName,
version: '',
envVariable: envVar
]
}
withPipeline("nodejs", product, component) {
// installCharts()
enableAksStagingDeployment()
disableLegacyDeployment()
env.FEATURE_IDAM = 'true'
env.IDAM_API_URL = 'https://idam-api.aat.platform.hmcts.net'
if (env.CHANGE_TITLE) {
if(env.CHANGE_TITLE.startsWith('[PREVIEW]')) {
env.RUN_BASIC_TESTS = "true"
} else {
loadVaultSecrets(secrets)
}
}
afterSuccess('build') {
yarnBuilder.yarn('setup')
}
afterSuccess('test') {
yarnBuilder.yarn('test-validation')
}
before('functionalTest:aat') {
//This is to force the loading of preview.yaml instead of testing.yaml in PRs
env.NODE_CONFIG_ENV = 'aat'
}
afterSuccess('functionalTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'smoke-output/**/*'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'functional-output/**/*'
}
before('functionalTest:preview') {
//This is to force the loading of preview.yaml instead of testing.yaml in PRs
env.NODE_CONFIG_ENV = 'preview'
}
afterSuccess('functionalTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'smoke-output/**/*'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'functional-output/**/*'
}
}