-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathJenkinsfile_nightly
119 lines (105 loc) · 3.59 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
#!groovy
properties([
[
$class : 'GithubProjectProperty',
displayName : 'MediaViewer',
projectUrlStr: 'https://github.com/hmcts/em-media-viewer/'
],
pipelineTriggers([
cron('H 05 * * *')
]),
parameters([
string(name: 'ENVIRONMENT', defaultValue: 'aat', description: 'Environment to test'),
string(name: 'IDAM_API_URL', defaultValue: 'https://idam-api.aat.platform.hmcts.net', description: 'The Url of IDAM'),
string(name: 'S2S_PROVIDER_URL', defaultValue: 'http://rpe-service-auth-provider-aat.service.core-compute-aat.internal', description: 'The Url of S2S provider'),
string(name: 'CCD_DATA_STORE_URL', defaultValue: 'http://ccd-data-store-api-aat.service.core-compute-aat.internal', description: 'The Url of ccd data store'),
string(name: 'SecurityRules',
defaultValue: 'https://raw.githubusercontent.com/hmcts/security-test-rules/master/conf/security-rules.conf',
description: 'The URL you want to run these tests against'),
])
])
@Library("Infrastructure")
def type = "nodejs"
def product = "em"
def component = "media-viewer"
def channel = '#xui-pipeline'
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)
def vaultOverrides = [
'aat' : params.ENVIRONMENT,
]
def secrets = [
"s2s-${params.ENVIRONMENT}": [
secret('microservicekey-em-gw', 'S2S_KEY')
],
"rpa-${params.ENVIRONMENT}": [
secret('show-oauth2-token', 'IDAM_SECRET')
],
"em-showcase-${params.ENVIRONMENT}": [
secret('ccd-user-email', 'CCD_CASEWORKER_E2E_EMAIL'),
secret('ccd-user-password', 'CCD_CASEWORKER_E2E_PASSWORD'),
secret('microservicekey-ccd-gw', 'MICROSERVICE_CCD_GW'),
secret('idam-client-secret', 'IDAM_CLIENT_SECRET')
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[ $class: 'AzureKeyVaultSecret',
secretType: 'Secret',
name: secretName,
version: '',
envVariable: envVar
]
}
withNightlyPipeline(type, product, component) {
env.TEST_URL = 'http://em-media-viewer-aat.service.core-compute-aat.internal'
env.IDAM_URL = params.IDAM_API_URL
env.S2S_PROVIDER = params.S2S_PROVIDER_URL
env.CCD_DATA_STORE_API_URL = params.CCD_DATA_STORE_URL
env.RUNNING_ENV = params.ENVIRONMENT
overrideVaultEnvironments(vaultOverrides)
loadVaultSecrets(secrets)
disableLegacyDeployment()
enableSecurityScan()
enableSlackNotifications(channel)
enableFullFunctionalTest(60)
enableCrossBrowserTest()
afterSuccess('checkout') {
sh ("rm -rf node_modules")
sh ("yarn cache clean")
sh ('npm rebuild node-sass')
sh ('yarn install --check-cache')
yarnBuilder.yarn('setup')
}
afterSuccess('build') {
yarnBuilder.yarn('build')
}
afterAlways('functionalTest') {
publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "functional-output/reports/html",
reportFiles : 'index.html',
reportName : 'Functional Tests'
])
}
afterAlways('crossBrowserTest') {
publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/crossbrowser/",
reportFiles : 'index.html',
reportName : 'Cross Browser Tests'
])
}
afterAlways('securityScan') {
publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/",
reportFiles : 'activescan.html',
reportName : 'ZAP Security Scan Report'
])
}
}