-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile_nightly
125 lines (105 loc) · 6.2 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
#!groovy
properties([
//pipelineTriggers([cron('30 02 * * *')]),
parameters([
string(name: 'ENVIRONMENT', defaultValue: 'aat', description: 'Environment to test'),
string(name: 'URL_TO_TEST', defaultValue: 'https://idam-web-public.aat.platform.hmcts.net', description: 'The URL you want to run these tests against'),
string(name: 'API_URL_TO_TEST', defaultValue: 'https://idam-api.aat.platform.hmcts.net', description: 'The API URL you want to run these tests against '),
string(name: 'TESTING_SUPPORT_API_URL', defaultValue: 'https://idam-testing-support-api.aat.platform.hmcts.net', description: 'The testing support api URL you want to run these tests against'),
string(name: 'RPE_AUTH_URL', defaultValue: 'http://rpe-service-auth-provider-aat.service.core-compute-aat.internal', description: 'The URL for s2s token authentication'),
string(name: 'REF_DATA_URL', defaultValue: 'http://rd-professional-api-aat.service.core-compute-aat.internal', description: 'The URL for calls to Ref Data (PRD)'),
string(name: 'WAIT_FOR_ACTION_TIMEOUT', defaultValue: '2000', description: 'How long to wait after click, doubleClick or PressKey actions in ms'),
string(name: 'SecurityRules', defaultValue: 'http://raw.githubusercontent.com/hmcts/security-test-rules/master/conf/security-rules.conf'),
string(name: 'ZAP_URL_EXCLUSIONS', defaultValue: "-config globalexcludeurl.url_list.url\\(1\\).regex=\\'.*jquery-3.5.1.min.js${'$'}\\' -config globalexcludeurl.url_list.url\\(2\\).regex=\\'.*/assets/images.*\\' -config globalexcludeurl.url_list.url\\(3\\).regex=\\'.*/assets/stylesheets.*\\' -config globalexcludeurl.url_list.url\\(4\\).regex=\\'.*/assets/javascripts.*\\' -config globalexcludeurl.url_list.url\\(5\\).regex=\\'.*/ruxitagentjs_.*\\' -config globalexcludeurl.url_list.url\\(6\\).regex=\\'.*/terms-and-conditions.*\\' -config globalexcludeurl.url_list.url\\(7\\).regex=\\'.*/privacy-policy.*\\' -config globalexcludeurl.url_list.url\\(8\\).regex=\\'.*/contact-us.*\\' -config globalexcludeurl.url_list.url\\(9\\).regex=\\'.*/login.*\\' -config globalexcludeurl.url_list.url\\(10\\).regex=\\'.*/cookies.*\\' -config globalexcludeurl.url_list.url\\(11\\).regex=\\'.*/cookie-preferences.*\\' -config globalexcludeurl.url_list.url\\(12\\).regex=\\'.*jquery-3.4.1.min.js${'$'}\\'"),
booleanParam(name: 'skipSecurityScanTests', defaultValue: false, description: 'Runs on aat envt only, tick the checkbox for skip'),
booleanParam(name: 'skipMutationTests', defaultValue: false, description: 'Tick the checkbox for skip'),
booleanParam(name: 'skipFullFunctionalTests', defaultValue: false, description: 'Tick the checkbox for skip'),
booleanParam(name: 'skipCrossBrowserTests', defaultValue: false, description: 'Tick the checkbox for skip'),
booleanParam(name: 'skipFortifyTests', defaultValue: true, description: 'Tick the checkbox for skip'),
booleanParam(name: 'USE_PROXY_SERVER', defaultValue: false, description: 'use proxy server for tests (proxyout.reform.hmcts.net:8080)'),
])
])
@Library("Infrastructure@DTSPO-15437/gradle-frontend") _
import uk.gov.hmcts.contino.GradleBuilder
GradleBuilder builder = new GradleBuilder(this, 'jenkins-library')
def type = "java"
def product = "idam"
def component = "web-public"
def urlExclusions = params.ZAP_URL_EXCLUSIONS
def secrets = [
"idam-idam-${params.ENVIRONMENT}": [
secret('smoke-test-user-username', 'SMOKE_TEST_USER_USERNAME'),
secret('smoke-test-user-password', 'SMOKE_TEST_USER_PASSWORD'),
secret('notify-api-key', 'NOTIFY_API_KEY'),
secret('EJUDICIARY-TEST-USER-PASSWORD', 'EJUDICIARY_TEST_USER_PASSWORD'),
secret('MOJ-TEST-USER-PASSWORD', 'MOJ_TEST_USER_PASSWORD')
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
version : '',
envVariable: envVar
]
}
try {
withNightlyPipeline(type, product, component) {
env.Rules = params.SecurityRules
env.TEST_URL = params.URL_TO_TEST
env.IDAMAPI = params.API_URL_TO_TEST
env.TESTING_SUPPORT_API_URL = params.TESTING_SUPPORT_API_URL
env.RPE_AUTH_URL = params.RPE_AUTH_URL
env.REF_DATA_URL = params.REF_DATA_URL
env.WAIT_FOR_ACTION_TIMEOUT = params.WAIT_FOR_ACTION_TIMEOUT
loadVaultSecrets(secrets)
if (params.ENVIRONMENT == 'aat' && !params.skipSecurityScanTests) {
enableSecurityScan(
urlExclusions: urlExclusions,
scanType: "frontend"
)
}
if (!params.skipMutationTests) {
enableMutationTest()
}
if (!params.skipFullFunctionalTests) {
enableFullFunctionalTest(200)
}
if (!params.skipCrossBrowserTests) {
enableCrossBrowserTest()
}
if (params.ENVIRONMENT == 'aat' && !params.skipFortifyTests) {
enableFortifyScan('idam-idam-' + params.ENVIRONMENT)
}
afterSuccess('fortify-scan') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Fortify Scan/**/*'
}
before('fullFunctionalTest') {
env.TESTS_FOR_ACCESSIBILITY = true
}
afterSuccess('fullFunctionalTest') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
env.TESTS_FOR_ACCESSIBILITY = false
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "output",
reportFiles : "idam-web-public-e2e-result.html",
reportName : "IDAM Web Public E2E functional tests result"
]
}
}
} catch (err) {
node {
onMaster() {
def slackMessage = "Idam Web Public nightly pipeline failed:"
slackMessage += "\nLink to build ${BUILD_ID}:\n${BUILD_URL}"
slackSend(
channel: "#idam-nightly-pipelines",
color: 'danger',
message: slackMessage)
}
}
throw err
}