-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathJenkinsfile_CNP
251 lines (217 loc) · 8.66 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
#!groovy
@Library("Infrastructure")
import uk.gov.hmcts.contino.AppPipelineDsl
def type = "java"
def product = "rd"
def component = "professional-api"
/* The below Key Vault secrets will be used for functional and smoke tests */
def secrets = [
's2s-${env}': [
secret('microservicekey-rd-professional-api', 'PROFESSIONAL_API_S2S_SECRET')
],
'rd-${env}' : [
secret('ACCOUNT-KEY-PREVIEW', 'ACCOUNT_KEY_PREVIEW'),
secret('rd-prd-storage-account-name', 'ACCOUNT_NAME'),
secret('rd-prd-storage-account-primary-key', 'ACCOUNT_KEY'),
secret('OAUTH2-CLIENT-SECRET', 'OAUTH2_CLIENT_SECRET'),
secret('OAUTH2-CLIENT-AUTH', 'OAUTH2_CLIENT_AUTH'),
secret('OAUTH2-CLIENT-ID', 'OAUTH2_CLIENT_ID'),
secret('LD-SDK-KEY', 'LD_SDK_KEY')
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
version : '',
envVariable: envVar
]
}
def vaultOverrides = [
'preview' : 'aat',
'spreview': 'saat'
]
// Configure branches to sync with master branch
def branchesToSync = ['demo', 'ithc', 'perftest']
// Var for testcontainers.org
env.TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX = "hmctspublic.azurecr.io/imported/"
// Vars for Kubernetes
env.PACT_BROKER_FULL_URL = 'https://pact-broker.platform.hmcts.net'
env.PACT_BROKER_URL = 'pact-broker.platform.hmcts.net'
env.PACT_BROKER_SCHEME = 'https'
env.PACT_BROKER_PORT = '443'
withPipeline(type, product, component) {
overrideVaultEnvironments(vaultOverrides)
loadVaultSecrets(secrets)
enableDbMigration('rd')
disableLegacyDeployment()
enableAksStagingDeployment()
env.S2S_URL_FOR_TESTS = "http://rpe-service-auth-provider-aat.service.core-compute-aat.internal"
env.IDAM_URL = "https://idam-api.aat.platform.hmcts.net"
before('functionalTest:preview') {
env.execution_environment = "preview"
env.TEST_URL = "http://rd-professional-api-preview.preview.hmcts.platform.net"
}
before('functionalTest:aat') {
env.execution_environment = "aat"
env.TEST_URL = "http://rd-professional-api-aat.aat.hmcts.platform.net"
}
before('smoketest:preview') {
env.execution_environment = "preview"
env.TEST_URL = "http://rd-professional-api-preview.preview.platform.hmcts.net"
}
before('smoketest:aat') {
env.execution_environment = "aat"
env.TEST_URL = "http://rd-professional-api-aat.aat.platform.hmcts.net"
}
// Sync demo and perftest with master branch
syncBranchesWithMaster(branchesToSync)
afterAlways('sonarscan') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/test",
reportFiles : "index.html",
reportName : "Unit Tests Report"
]
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/integration",
reportFiles : "index.html",
reportName : "Integration Test Report"
]
}
afterAlways('smoketest:preview') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/smoke",
reportFiles : "index.html",
reportName : "Smoke Test Report"
]
}
afterAlways('smoketest:aat') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/smoke",
reportFiles : "index.html",
reportName : "Smoke Test Report"
]
}
afterAlways('functionalTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "target/site/serenity/",
reportFiles : "index.html",
reportName : "Functional Tests Report"
]
}
afterAlways('functionalTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "target/site/serenity/",
reportFiles : "index.html",
reportName : "Functional Tests Report"
]
}
afterAlways('pact-provider-verification') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/runProviderPactVerification",
reportFiles : "index.html",
reportName : "Contract Tests Report"
]
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/tests/**/*'
}
afterAlways('sonarscan') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/test",
reportFiles : "index.html",
reportName : "Unit Tests Report"
]
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/integration",
reportFiles : "index.html",
reportName : "Integration Test Report"
]
}
afterAlways('smoketest:preview') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/smoke",
reportFiles : "index.html",
reportName : "Smoke Test Report"
]
}
afterAlways('smoketest:aat') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/smoke",
reportFiles : "index.html",
reportName : "Smoke Test Report"
]
}
afterAlways('functionalTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "target/site/serenity/",
reportFiles : "index.html",
reportName : "Functional Tests Report"
]
}
afterAlways('functionalTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "target/site/serenity/",
reportFiles : "index.html",
reportName : "Functional Tests Report"
]
}
afterAlways('pact-provider-verification') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/runProviderPactVerification",
reportFiles : "index.html",
reportName : "Contract Tests Report"
]
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/tests/**/*'
}
onMaster() {
enablePactAs([AppPipelineDsl.PactRoles.PROVIDER])
}
onPR() {
enablePactAs([AppPipelineDsl.PactRoles.PROVIDER])
}
}