-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile_CNP
executable file
·107 lines (97 loc) · 5 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!groovy
@Library("Infrastructure")
import uk.gov.hmcts.contino.GradleBuilder
def type = "java"
def product = "darts"
def component = "automation"
def secrets = [
'darts-${env}': [
secret('api-FUNC-TEST-ROPC-PASSWORD', 'FUNC_TEST_ROPC_USERNAME'),
secret('api-FUNC-TEST-ROPC-USERNAME', 'FUNC_TEST_ROPC_PASSWORD'),
secret('AzureAdB2CTenantId', 'AAD_B2C_TENANT_ID'),
// secret('AzureAdB2CClientIdKey', 'AAD_B2C_CLIENT_ID_KEY'),
// secret('AzureAdB2CClientSecretKey', 'AAD_B2C_CLIENT_SECRET_KEY'),
secret('AzureAdB2CFuncTestROPCGlobalUsername', 'FUNC_TEST_ROPC_GLOBAL_USERNAME'),
secret('AzureAdB2CFuncTestROPCGlobalPassword', 'FUNC_TEST_ROPC_GLOBAL_PASSWORD'),
secret('AzureAdB2CFuncTestROPCClientId', 'AAD_B2C_ROPC_CLIENT_ID'),
// secret('AzureAdB2CFuncTestROPCClientIdKey', 'AAD_B2C_ROPC_CLIENT_ID_KEY'),
// secret('AzureAdB2CFuncTestROPCClientSecretKey', 'AAD_B2C_ROPC_CLIENT_SECRET_KEY'),
secret('AzureAdB2CFuncTestROPCClientSecret', 'AAD_B2C_ROPC_CLIENT_SECRET'),
secret('api-POSTGRES-SCHEMA', 'DARTS_API_DB_SCHEMA'),
secret('api-POSTGRES-HOST', 'DARTS_API_DB_HOST'),
secret('api-POSTGRES-DATABASE', 'DARTS_API_DB_DATABASE'),
secret('api-POSTGRES-PORT', 'DARTS_API_DB_PORT'),
secret('api-POSTGRES-USER', 'DARTS_API_DB_USERNAME'),
secret('api-POSTGRES-PASS', 'DARTS_API_DB_PASSWORD'),
secret('AzureStorageConnectionString', 'AZURE_STORAGE_CONNECTION_STRING'),
secret('AzureADTenantId', 'AAD_TENANT_ID'),
secret('AzureADClientId', 'AAD_CLIENT_ID'),
secret('AzureADClientSecret', 'AAD_CLIENT_SECRET'),
secret('AutomationTestUserName', 'AUTOMATION_USERNAME'),
secret('AutomationTestPassword', 'AUTOMATION_PASSWORD'),
secret('DartsTranscriberTestUsername', 'AUTOMATION_TRANSCRIBER_USERNAME'),
secret('DartsLanguageShopTestUsername', 'AUTOMATION_LANGUAGE_SHOP_TEST_USERNAME'),
secret('DartsExternalUsersTestPassword', 'AUTOMATION_EXTERNAL_PASSWORD'),
secret('DartsJudgeTestUsername', 'AUTOMATION_JUDGE_TEST_USERNAME'),
secret('DartsRequesterTestUsername', 'AUTOMATION_REQUESTER_TEST_USERNAME'),
secret('DartsApproverTestUsername', 'AUTOMATION_APPROVER_TEST_USERNAME'),
secret('DartsAppealCourtTestUsername', 'AUTOMATION_APPEAL_COURT_TEST_USERNAME'),
secret('DartsInternalUserTestPassword', 'AUTOMATION_INTERNAL_PASSWORD'),
secret('DartsRequesterApproverUsername', 'AUTOMATION_REQUESTER_APPROVER_USERNAME'),
secret('DartsRequesterApproverPassword', 'AUTOMATION_REQUESTER_APPROVER_PASSWORD'),
secret('DartsSuperUser', 'AUTOMATION_SUPER_USER_USERNAME'),
secret('XhibitUserName', 'XHIBIT_USERNAME'),
secret('XhibitPassword', 'XHIBIT_PASSWORD'),
secret('CppUserName', 'CPP_USERNAME'),
secret('CppPassword', 'CPP_PASSWORD'),
secret('DarMidTierUserName', 'DAR_MID_TIER_USERNAME'),
secret('DarMidTierPassword', 'DAR_MID_TIER_PASSWORD'),
secret('DarPCMidTierUserName', 'DAR_PC_MID_TIER_USERNAME'),
secret('DarPCMidTierPassword', 'DAR_PC_MID_TIER_PASSWORD'),
secret('DarPCUserName', 'DAR_PC_USERNAME'),
secret('DarPCPassword', 'DAR_PC_PASSWORD'),
secret('DartsAdminUserName', 'DARTS_ADMIN_USERNAME'),
secret('ViQExternalPassword', 'VIQ_EXTERNAL_PASSWORD'),
secret('ViQExternalUserName', 'VIQ_EXTERNAL_USERNAME'),
secret('ViQInternalPassword', 'VIQ_INTERNAL_PASSWORD'),
secret('XhibitExternalPassword', 'XHIBIT_EXTERNAL_PASSWORD'),
secret('XhibitExternalUserName', 'XHIBIT_EXTERNAL_USERNAME'),
secret('XhibitInternalPassword', 'XHIBIT_INTERNAL_PASSWORD'),
secret('CPExternalPassword', 'CP_EXTERNAL_PASSWORD'),
secret('CPExternalUserName', 'CP_EXTERNAL_USERNAME'),
secret('CPInternalPassword', 'CP_INTERNAL_PASSWORD')
],
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
version : '',
envVariable: envVar
]
}
GradleBuilder builder = new GradleBuilder(this, product)
// this "Jenkinsfile_CNP" file defines the build to run on PRs and master branch, not nightly
// we are only using the "withNightlyPipeline" function here as it better suits the steps we require e.g. check, build and functional tests
// but rest assured this will not run nightly, that is defined by the "Jenkinsfile_nightly"
withNightlyPipeline(type, product, component) {
loadVaultSecrets(secrets)
enableFullFunctionalTest(90)
enableSlackNotifications('#darts-builds')
before('fullFunctionalTest') {
// set the tags to run on the nightly build
env.INCLUDE_TAGS = "smoketest"
}
afterAlways('fullFunctionalTest') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "test-results/html",
reportFiles : "results.html",
reportName : "Cucumber Test Report"
]
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'test-results/functionalTest/cucumber.xml'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'automation.log'
}
}