generated from hmcts/expressjs-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile_CNP
121 lines (95 loc) · 3.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
#!groovy
@Library('Infrastructure')
import uk.gov.hmcts.contino.AppPipelineConfig
import uk.gov.hmcts.contino.AppPipelineDsl
def type = 'nodejs'
def product = 'adoption'
def component = 'web'
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[ $class: 'AzureKeyVaultSecret',
secretType: 'Secret',
name: secretName,
version: '',
envVariable: envVar
]
}
def secrets = [
'adoption-${env}': [
secret('idam-secret', 'IDAM_SECRET'),
secret('citizen-user', 'CITIZEN_USERNAME'),
secret('citizen-password', 'CITIZEN_PASSWORD'),
secret('adoption-pcq-token', 'PCQ_TOKEN'),
secret('endpoints', 'ENDPOINTS'),
secret('idam-system-user-password', 'TEST_PASSWORD'),
secret('adoption-web-auth-token', 'AUTH_TOKEN'),
secret('idam-token-url', 'IDAM_TOKEN_URL'),
secret('idam-citizen-user-password', 'IDAM_CITIZEN_USER_PASSWORD')
],
's2s-${env}': [
secret('microservicekey-adoption-web', 'SERVICE_AUTH_SECRET')
]
]
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)
def branchesToSync = ['demo', 'ithc', 'perftest']
def pipelineConf = new AppPipelineConfig()
pipelineConf.vaultSecrets = secrets
env.IDAM_URL = 'https://idam-api.aat.platform.hmcts.net'
withPipeline(type, product, component) {
enableAksStagingDeployment()
disableLegacyDeployment()
syncBranchesWithMaster(branchesToSync)
enableSlackNotifications('#adoption-tech')
loadVaultSecrets(secrets)
enablePactAs([ AppPipelineDsl.PactRoles.CONSUMER ])
before('test') {
setupSecretsForIntegrationTests(pipelineConf)
}
onMaster {
env.PACT_TAG = 'master'
}
afterAlways('build') {
yarnBuilder.yarn('build')
}
afterAlways('test') {
yarnBuilder.yarn('test:integration')
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'coverage/**/*'
// teardown test secrets
env.AUTH_TOKEN = ''
}
before('functionalTest:preview') {
env.ADOP_WEB_URL = "https://adoption-web-pr-${CHANGE_ID}.preview.platform.hmcts.net/"
yarnBuilder.yarn('test:pa11y')
}
afterAlways('functionalTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
}
before('smoketest:preview') {
env.ADOP_WEB_URL = "https://adoption-web-pr-${CHANGE_ID}.preview.platform.hmcts.net/"
}
afterAlways('smoketest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
}
before('smoketest:aat') {
env.ADOP_WEB_URL = "https://adoption-web-staging.aat.platform.hmcts.net/"
}
afterAlways('smoketest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
}
before('functionalTest:aat') {
env.ADOP_WEB_URL = "https://adoption-web-staging.aat.platform.hmcts.net/"
yarnBuilder.yarn('test:functional:skip')
}
afterAlways('functionalTest:aat') {
yarnBuilder.yarn('test:pa11y')
yarnBuilder.yarn('test:api')
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'coverage/**/*'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
}
}
def setupSecretsForIntegrationTests(pipelineConf) {
withSubscription('nonprod') {
withTeamSecrets(pipelineConf, 'aat') {
env.AUTH_TOKEN = "${AUTH_TOKEN}"
}
}
}