-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile_nightly
93 lines (77 loc) · 3.55 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
#!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 08 * * 1-5')]),
parameters([
string(name: 'URL_TO_TEST', defaultValue: 'http://pcq-consolidation-service-aat.service.core-compute-aat.internal', description: 'The URL you want to run these tests against'),
string(name: 'PCQ_BACKEND_URL', defaultValue: 'http://pcq-consolidation-service-aat.service.core-compute-aat.internal', description: 'The PCQ backend URL'),
string(name: 'SecurityRules',
defaultValue: 'https://raw.githubusercontent.com/hmcts/security-test-rules/master/conf/security-rules.conf',
description: 'The URL you want to run these tests against'),
])
])
@Library("Infrastructure")
import uk.gov.hmcts.contino.GradleBuilder
def type = "java"
def product = "pcq"
def component = "consolidation-service"
def secrets = [
'pcq-${env}': [
secret( 'jwt-secret', 'JWT_SECRET'),
secret( 's2s-secret-pcq-consolidation-service', 'S2S_SECRET'),
secret( 'idam-users-pcq-username', 'IDAM_USERS_PCQ_USERNAME'),
secret( 'idam-users-pcq-password', 'IDAM_USERS_PCQ_PASSWORD'),
secret( 'idam-client-secret', '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)
withNightlyPipeline(type, product, component) {
env.TEST_URL = params.URL_TO_TEST
env.PCQ_BACKEND_URL = params.PCQ_BACKEND_URL
env.Rules = params.SecurityRules
loadVaultSecrets(secrets)
enableAksStagingDeployment()
disableLegacyDeployment()
nonServiceApp()
enableMutationTest()
enableFortifyScan()
afterAlways('fortify-scan') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Fortify Scan/**/*'
}
afterAlways('mutationTest') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'builds/reports/pitest/**/*'
}
enableFullFunctionalTest()
before('fullFunctionalTest') {
echo "Loading the secrets again"
loadVaultSecrets(secrets)
// To run functional tests
env.S2S_NAME = 'pcq_consolidation_service'
env.S2S_URL = 'http://rpe-service-auth-provider-aat.service.core-compute-aat.internal'
env.DOCUMENT_MANAGEMENT_URL = 'http://dm-store-aat.service.core-compute-aat.internal'
env.CORE_CASE_DATA_API_URL = 'http://ccd-data-store-api-aat.service.core-compute-aat.internal'
env.IDAM_API_URL = 'https://idam-api.aat.platform.hmcts.net'
env.IDAM_CLIENT_NAME = 'pcq'
env.IDAM_CLIENT_REDIRECT_URI = 'https://pcq-consolidation-service-aat.service.core-compute-aat.internal/oauth2/callback'
env.PCQ_BACKEND_URL = "http://pcq-backend-aat.service.core-compute-aat.internal"
echo "Just waiting a while to ensure that the pod has run the job"
sh "sleep 120s"
echo "Verifying that functional test data was processed correctly"
try {
builder.gradle('functional')
} finally {
junit '**/test-results/**/*.xml'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/test-results/**'
}
}
enableSlackNotifications('#pcq-builds')
}