-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile_CNP
92 lines (78 loc) · 2.6 KB
/
Jenkinsfile_CNP
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
#!groovy
import uk.gov.hmcts.contino.AppPipelineDsl
import uk.gov.hmcts.contino.GithubAPI
@Library("Infrastructure")
String product = "probate"
String component = "caveats-fe"
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)
def secrets = [
'probate-${env}': [
secret('testIdamBaseUrl', 'IDAM_API_URL'),
secret('testSurvey', 'SURVEY'),
secret('testsurveyEndOfApplication', 'SURVEY_END_OF_APPLICATION'),
secret('testUseGovPay', 'USE_GOV_PAY'),
secret('testValidationServiceUrl', 'TEST_VALIDATION_SERVICE_URL'),
secret('caveat-user-name', 'CAVEAT_USER_EMAIL'),
secret('caveat-user-password', 'CAVEAT_USER_PASSWORD')
]
]
def checkForNightlyLabel(branch_name) {
return new GithubAPI(this).getLabelsbyPattern(branch_name, "nightly").contains("nightly")
}
def checkForNightlyWithoutWelshTestsLabel(branch_name) {
return new GithubAPI(this).getLabelsbyPattern(branch_name, "nightly-without-welsh-tests").contains("nightly-without-welsh-tests")
}
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[ $class: 'AzureKeyVaultSecret',
secretType: 'Secret',
name: secretName,
version: '',
envVariable: envVar
]
}
// Configure branches to sync with master branch
def branchesToSync = ['demo', 'ithc', 'perftest']
withPipeline("nodejs", product, component) {
env.RUN_E2E_TEST = true
afterSuccess('build') {
yarnBuilder.yarn('setup')
}
enableAksStagingDeployment()
disableLegacyDeployment()
loadVaultSecrets(secrets)
enableSlackNotifications('#probate-jenkins')
syncBranchesWithMaster(branchesToSync)
afterSuccess('functionalTest:preview') {
publishHTML target: [
reportDir : "functional-output/",
reportFiles : "mochawesome.html",
reportName : "Caveat Preview E2E Tests",
alwaysLinkToLastBuild: true
]
env.TEST_E2E_URL = env.TEST_URL
if (checkForNightlyWithoutWelshTestsLabel(env.BRANCH_NAME)) {
env.DONT_TEST_WELSH = true
yarnBuilder.yarn('test:fullfunctional');
} else if (checkForNightlyLabel(env.BRANCH_NAME)) {
yarnBuilder.yarn('test:fullfunctional');
}
}
afterSuccess('functionalTest:aat') {
publishHTML target: [
reportDir : "functional-output/",
reportFiles : "mochawesome.html",
reportName : "Caveat E2E Tests",
alwaysLinkToLastBuild: true
]
}
onMaster() {
enablePactAs([
AppPipelineDsl.PactRoles.CONSUMER
])
}
onPR() {
enablePactAs([
AppPipelineDsl.PactRoles.CONSUMER
])
}
}