-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathJenkinsfile_nightly
194 lines (177 loc) · 7.02 KB
/
Jenkinsfile_nightly
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
#!groovy
properties([
pipelineTriggers([cron('H 13 * * 1-5')]),
parameters([
string(name: 'FE_BASE_URL', defaultValue: 'https://manage-case.aat.platform.hmcts.net',
description: 'The URL you want to run the full functional tests against'),
string(name: 'CASE_SERVICE_URL', defaultValue: 'http://fpl-case-service-aat.service.core-compute-aat.internal',
description: 'The URL of case service callbacks'),
string(name: 'IDAM_API_URL', defaultValue: 'https://idam-api.aat.platform.hmcts.net',
description: 'The URL of idam api'),
string(name: 'ENVIRONMENT', defaultValue: 'aat',
description: 'Envirnonment of test execution'),
])
])
@Library('Infrastructure')
import uk.gov.hmcts.contino.AppPipelineConfig
def type = 'java'
def product = 'fpl'
def component = 'case-service'
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)
AppPipelineConfig pipelineConf;
def integrationTestSecrets = [
'fpl-aat': [
secret('integration-test-notify-service-key', 'INTEGRATION_TEST_NOTIFY_SERVICE_KEY'),
secret('docmosis-api-key', 'INTEGRATION_TEST_DOCMOSIS_TORNADO_KEY'),
secret('e2e-test-password', 'E2E_TEST_PASSWORD'),
secret('system-update-user-username', 'SYSTEM_UPDATE_USER_USERNAME'),
secret('system-update-user-password', 'SYSTEM_UPDATE_USER_PASSWORD'),
secret('e2e-test-judge-password', 'E2E_TEST_JUDGE_PASSWORD')
]
]
static Map < String, Object > secret(String secretName, String envVariable) {
[$class: 'AzureKeyVaultSecret',
secretType: 'Secret',
name: secretName,
envVariable: envVariable
]
}
def setupSecretsForIntegrationTests(pipelineConf) {
withSubscription('nonprod') {
withTeamSecrets(pipelineConf, 'aat') {
/* Setup Email template integration tests key with gov.notify */
env.INTEGRATION_TEST_NOTIFY_SERVICE_KEY = "${INTEGRATION_TEST_NOTIFY_SERVICE_KEY}"
/* Setup Docmosis template integration tests key and url */
env.INTEGRATION_TEST_DOCMOSIS_TORNADO_KEY = "${INTEGRATION_TEST_DOCMOSIS_TORNADO_KEY}"
env.INTEGRATION_TEST_DOCMOSIS_TORNADO_URL = 'https://docmosis.aat.platform.hmcts.net'
env.INTEGRATION_TEST_DOCMOSIS_TORNADO_OUTPUT_FOLDER = "${WORKSPACE}/build/docmosis-generated"
}
}
}
def archiveExtraFilesForIntegrationTests() {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: "build/docmosis-generated/**/*"
}
def teardownSecretsForIntegrationTests() {
env.INTEGRATION_TEST_NOTIFY_SERVICE_KEY = ''
env.INTEGRATION_TEST_DOCMOSIS_TORNADO_KEY = ''
env.INTEGRATION_TEST_DOCMOSIS_TORNADO_URL = ''
env.INTEGRATION_TEST_DOCMOSIS_TORNADO_OUTPUT_FOLDER = ''
}
withNightlyPipeline(type, product, component) {
pipelineConf = config;
env.URL = params.FRONTEND_URL
env.URL_FOR_SECURITY_SCAN = params.CASE_SERVICE_URL
env.IDAM_API_URL = params.IDAM_API_URL
env.CASE_SERVICE_URL = params.CASE_SERVICE_URL
env.SECURITY_RULES = params.SECURITY_RULES
env.ORG_ID = params.ORG_ID
loadVaultSecrets(integrationTestSecrets)
enableMutationTest()
enableFortifyScan('fpl-aat')
enableFullFunctionalTest(240)
before('mutationTest') {
setupSecretsForIntegrationTests(pipelineConf)
}
afterAlways('mutationTest') {
archiveExtraFilesForIntegrationTests()
teardownSecretsForIntegrationTests()
}
before('fullFunctionalTest') {
yarnBuilder.yarn('yarn-update')
yarnBuilder.yarn('install-dependencies')
env.MOCKED_PAYMENTS = false
env.TEST_RETRIES = 2
env.TESTS_FOR_ACCESSIBILITY = true
env.ENV = 'aat'
}
afterAlways('fullFunctionalTest') {
stage('Functional UI tests chromium') {
try {
yarnBuilder.yarn('test:functional-chromium')
} catch (Error) {
unstable(message: "${STAGE_NAME} is unstable: " + Error.toString())
} finally {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'playwright-report',
reportFiles: 'index.html',
reportName: 'UITestChromiumReport'
])
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/tests/functionalTest/**/*'
}
}
stage('Functional UI tests firefox') {
try {
yarnBuilder.yarn('test:functional-firefox')
} catch (Error) {
unstable(message: "${STAGE_NAME} is unstable: " + Error.toString())
} finally {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'playwright-report',
reportFiles: 'index.html',
reportName: 'UITestFirefoxReport'
])
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/tests/functionalTest/**/*'
}
}
stage('Functional UI tests webkit ') {
try {
yarnBuilder.yarn('test:functional-webkit')
} catch (Error) {
unstable(message: "${STAGE_NAME} is unstable: " + Error.toString())
} finally {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'playwright-report',
reportFiles: 'index.html',
reportName: 'UITestWebkitReport'
])
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/tests/functionalTest/**/*'
}
}
stage('Functional UI tests ipadPro11 ') {
try {
yarnBuilder.yarn('test:functional-ipadPro11')
} catch (Error) {
unstable(message: "${STAGE_NAME} is unstable: " + Error.toString())
} finally {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'playwright-report',
reportFiles: 'index.html',
reportName: 'UITestipadPro11Report'
])
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/tests/functionalTest/**/*'
}
}
stage('Functional UI tests galaxyS4 ') {
try {
yarnBuilder.yarn('test:functional-galaxyS4')
} catch (Error) {
unstable(message: "${STAGE_NAME} is unstable: " + Error.toString())
} finally {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'playwright-report',
reportFiles: 'index.html',
reportName: 'UITestGalaxyS4Report'
])
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/tests/functionalTest/**/*'
}
}
}
afterAlways('fortify-scan') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Fortify Scan/**/*'
}
}