-
Notifications
You must be signed in to change notification settings - Fork 5
/
Jenkinsfile_nightly
82 lines (69 loc) · 2.41 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
#!groovy
properties([
// H allow predefined but random minute see https://en.wikipedia.org/wiki/Cron#Non-standard_characters
//PCQ-1536 (Stop running Nightly builds on weekends). Original schedule was 'H 05 * * *'
pipelineTriggers([cron('H 8 * * 1-5')]),
parameters([
string(name: 'URL_TO_TEST', defaultValue: 'https://pcq.aat.platform.hmcts.net', description: 'The URL you want to run these tests against'),
string(name: 'ZAP_URL_EXCLUSIONS', defaultValue: "-config globalexcludeurl.url_list.url(1).regex='.*ruxitagentjs_.*'")
])
])
@Library("Infrastructure")
def type = "nodejs"
def product = "pcq"
def component = "frontend"
def urlExclusions = params.ZAP_URL_EXCLUSIONS
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)
def secrets = [
'pcq-${env}': [
secret('jwt-secret', 'JWT_SECRET'),
secret('probate-token-key', 'PROBATE_TOKEN_KEY')
]
]
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 = params.URL_TO_TEST
loadVaultSecrets(secrets)
enableMutationTest();
enableSlackNotifications('#pcq-builds')
enableFortifyScan()
enableCrossBrowserTest()
enableFullFunctionalTest(20)
before('fullFunctionalTest') {
yarnBuilder.yarn("playwright install")
}
afterAlways('build') {
sh 'yarn setup'
}
afterAlways('fortify-scan') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Fortify Scan/**/*'
// executing Groovy commands in Jenkins is not allowed therefore a workaround
// to run security scan on 16th day of every month
currentDay = sh(returnStdout: true, script: 'date "+%d"').trim()
if (currentDay == '16') {
enableSecurityScan(
urlExclusions: urlExclusions
)
}
}
afterAlways('crossBrowserTest') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'functional-output/**/*'
}
afterAlways('fullFunctionalTest') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "output",
reportFiles : "PCQ-e2e-result.html",
reportName : "PCQ E2E functional tests result"
]
}
}