generated from hmcts/expressjs-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile_nightly
106 lines (91 loc) · 3.7 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
#!groovy
properties([
// H allow predefined but random minute see https://en.wikipedia.org/wiki/Cron#Non-standard_characters
pipelineTriggers([cron('H 8 * * 1-5')]),
parameters([
string(name: 'FRONTEND_URL', defaultValue: 'https://adoption-web.aat.platform.hmcts.net/', description: 'The URL you want to run tests against'),
string(name: 'IDAM_TOKEN_URL', defaultValue: 'https://idam-web-public.aat.platform.hmcts.net/o/token', description: 'The URL you want to use idam user creation'),
string(name: 'FUNCTIONAL_TESTS_WORKERS',
defaultValue: '2',
description: 'Number of workers running functional tests'),
string(name: 'ENVIRONMENT', defaultValue: 'aat', description: 'The environment you would like to point Playwright at'),
])
])
@Library("Infrastructure")
import uk.gov.hmcts.contino.AppPipelineConfig
import uk.gov.hmcts.contino.AppPipelineDsl
def type = "nodejs"
def product = "adoption"
def component = "web"
// SAUCELABS config - configured on Jenkins
env.SAUCE_USERNAME = 'username'
env.SAUCE_ACCESS_KEY = 'privatekey'
env.SAUCE_TUNNEL_IDENTIFIER = 'reformtunnel'
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)
static Map<String, Object> secret(String secretName, String envVariable) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
envVariable: envVariable
]
}
def secrets = [
'adoption-${env}' :[
secret('idam-secret', 'IDAM_SECRET'),
secret('idam-system-user-password', 'TEST_PASSWORD'),
secret('citizen-user', 'CITIZEN_USERNAME'),
secret('citizen-password', 'CITIZEN_PASSWORD'),
secret('adoption-pcq-token', 'PCQ_TOKEN'),
secret('endpoints', 'ENDPOINTS'),
secret('adoption-web-auth-token', 'AUTH_TOKEN'),
secret('idam-token-url', 'IDAM_TOKEN_URL'),
secret('idam-citizen-user-password', 'IDAM_CITIZEN_USER_PASSWORD'),
secret('idam-testing-support-users-url', 'IDAM_TESTING_SUPPORT_USERS_URL')
],
's2s-${env}': [
secret('microservicekey-adoption-web', 'SERVICE_AUTH_SECRET')
]
]
def pipelineConf = new AppPipelineConfig()
pipelineConf.vaultSecrets = secrets
withNightlyPipeline(type, product, component) {
env.TEST_URL = "https://adoption-web.aat.platform.hmcts.net/"
env.ADOP_WEB_URL = params.FRONTEND_URL
env.ENVIRONMENT = params.ENVIRONMENT
enableFullFunctionalTest(120)
loadVaultSecrets(secrets)
enablePactAs([ AppPipelineDsl.PactRoles.CONSUMER ])
enableFortifyScan()
enableSecurityScan()
afterAlways('test') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'coverage/**/*'
}
before('fullFunctionalTest') {
env.PARALLEL_CHUNKS = params.FUNCTIONAL_TESTS_WORKERS
env.IDAM_TOKEN_URL = "${IDAM_TOKEN_URL}"
env.IDAM_CITIZEN_USER_PASSWORD = "${IDAM_CITIZEN_USER_PASSWORD}"
env.IDAM_TESTING_SUPPORT_USERS_URL = "${IDAM_TESTING_SUPPORT_USERS_URL}"
}
afterAlways('fullFunctionalTest') {
stage('UI Tests') {
try {
yarnBuilder.yarn('test:functional-nightly')
} 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: 'Playwright UI Functional Test Report'
])
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/tests/functionalTest/**/*'
}
}
}
afterAlways('fortify-scan') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Fortify Scan/**/*'
}
}