generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile_nightly
126 lines (105 loc) · 5.08 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
120
121
122
123
124
125
126
#!groovy
import uk.gov.hmcts.contino.GradleBuilder
properties([
// H allow predefined but random minute see https://en.wikipedia.org/wiki/Cron#Non-standard_characters
//CCD-3539 (Stop running Nightly builds on weekends) - At 05:00 on every day-of-week from Monday through Friday. Original schedule was 'H 05 * * *'
pipelineTriggers([cron('H 08 * * 1-5')])
])
@Library("Infrastructure")
def type = "java"
def product = "ccd"
def component = "next-hearing-date-updater"
def secrets = [
'rpx-${env}': [
secret('mc-idam-client-secret', 'BEFTA_OAUTH2_CLIENT_SECRET_OF_XUIWEBAPP')
],
's2s-${env}': [
secret('microservicekey-ccd-data', 'DATA_STORE_S2S_KEY'),
secret('microservicekey-ccd-definition', 'DEFINITION_STORE_S2S_KEY'),
secret('microservicekey-ccd-gw', 'CCD_API_GATEWAY_S2S_KEY'),
secret('microservicekey-ccd-gw', 'BEFTA_S2S_CLIENT_SECRET'),
secret('microservicekey-xui-webapp', 'BEFTA_S2S_CLIENT_SECRET_OF_XUI_WEBAPP'),
secret('microservicekey-ccd-next-hearing-date-updater', 'IDAM_KEY_NEXT_HEARING_UPDATER')
],
'ccd-${env}': [
secret('ccd-caseworker-autotest-email', 'CCD_CASEWORKER_AUTOTEST_EMAIL'),
secret('ccd-caseworker-autotest-password', 'CCD_CASEWORKER_AUTOTEST_PASSWORD'),
secret('definition-importer-username', 'DEFINITION_IMPORTER_USERNAME'),
secret('definition-importer-password', 'DEFINITION_IMPORTER_PASSWORD'),
secret('ccd-befta-caseworker-1-pwd', 'CCD_BEFTA_CASEWORKER_1_PWD'),
secret('ccd-befta-master-caseworker-pwd', 'CCD_BEFTA_MASTER_CASEWORKER_PWD'),
secret('ccd-api-gateway-oauth2-client-secret', 'CCD_API_GATEWAY_OAUTH2_CLIENT_SECRET'),
secret('idam-ccd-next-hearing-date-updater-system-user-username', 'IDAM_NEXT_HEARING_DATE_SYSTEM_USER'),
secret('idam-ccd-next-hearing-date-updater-system-user-password', 'IDAM_NEXT_HEARING_DATE_SYSTEM_PASSWORD'),
secret('idam-ccd-next-hearing-date-updater-client-secret', 'CCD_NEXT_HEARING_DATE_UPDATER_SERVICE_IDAM_CLIENT_SECRET')
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
version : '',
envVariable: envVar
]
}
GradleBuilder builder = new GradleBuilder(this, product)
env.CI_BUILD = true
withNightlyPipeline(type, product, component) {
// Set required environment variables to run functional tests apart from one in vaults.
env.IDAM_S2S_URL = "http://rpe-service-auth-provider-aat.service.core-compute-aat.internal"
env.S2S_URL_BASE = "http://rpe-service-auth-provider-aat.service.core-compute-aat.internal"
env.IDAM_API_URL_BASE = "https://idam-api.aat.platform.hmcts.net"
env.BEFTA_S2S_CLIENT_ID = "ccd_gw"
env.BEFTA_S2S_CLIENT_ID_OF_XUI_WEBAPP = "xui_webapp"
env.BEFTA_OAUTH2_CLIENT_ID_OF_XUIWEBAPP = "xuiwebapp"
env.BEFTA_OAUTH2_REDIRECT_URI_OF_XUIWEBAPP = "https://www-ccd.aat.platform.hmcts.net/oauth2redirect"
env.BEFTA_OAUTH2_ACCESS_TOKEN_TYPE_OF_XUIWEBAPP = "OIDC"
env.BEFTA_OAUTH2_SCOPE_VARIABLES_OF_XUIWEBAPP = "profile openid roles manage-user create-user search-user"
// NB: legacy config for def file import
env.CCD_API_GATEWAY_OAUTH2_REDIRECT_URL = "https://www-ccd.aat.platform.hmcts.net/oauth2redirect"
env.CCD_API_GATEWAY_OAUTH2_CLIENT_ID = "ccd_gateway"
env.CCD_API_GATEWAY_S2S_ID = "ccd_gw"
// temporary workaround for platform changes: turn BEFTA header checks to warning mode
env.BEFTA_RESPONSE_HEADER_CHECK_POLICY="JUST_WARN"
// apply standard `onNonPR` env variables for nightly
env.ENV='aat'
env.TEST_URL="http://ccd-data-store-api-aat.service.core-compute-aat.internal"
env.CCD_DATA_STORE_API_BASE_URL = "http://ccd-data-store-api-aat.service.core-compute-aat.internal"
env.DEFINITION_STORE_URL_BASE = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal"
enableAksStagingDeployment()
disableLegacyDeployment()
loadVaultSecrets(secrets)
nonServiceApp()
enableMutationTest()
enableFullFunctionalTest()
afterAlways('fortify-scan') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Fortify Scan/**/*'
}
afterAlways('mutationTest') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'functional-output/**/*'
}
before('fullFunctionalTest') {
echo "Loading the secrets"
loadVaultSecrets(secrets)
// Execute functional tests
echo "Just waiting a while to ensure that the pod has run the job"
sh "sleep 30s"
echo "Verifying that functional test run correctly"
try {
// NB: override IDAM_API_URL late as per `Jenkinsfile_CNP` tests
env.IDAM_API_URL = env.IDAM_API_URL_BASE
builder.functionalTest()
} finally {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/functional",
reportFiles : "overview-features.html,overview-failures.html,",
reportTitles : "Features,Failures",
reportName : "Next Hearing Date Updater Functional Test Report"
]
junit '**/test-results/functional/*.xml'
}
}
}