generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile_nightly
96 lines (81 loc) · 2.95 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
#!groovy
properties([
pipelineTriggers([cron('H 07 * * 1-5')]), // scheduling to trigger jenkins job
parameters([
string(name: 'URL_TO_TEST', defaultValue: 'http://rd-location-ref-data-load-aat.service.core-compute-aat.internal', description: 'The URL you want to run these tests against'),
string(name: 'SecurityRules',
defaultValue: 'http://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 = "rd"
def component = "location-ref-data-load"
def secrets = [
'rd-${env}': [
secret('rd-location-storage-account-name', 'ACCOUNT_NAME'),
secret('rd-location-storage-account-primary-key', 'ACCOUNT_KEY')
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
version : '',
envVariable: envVar
]
}
def vaultOverrides = [
'preview' : 'aat',
'spreview': 'saat'
]
GradleBuilder builder = new GradleBuilder(this, product)
withNightlyPipeline(type, product, component) {
env.Rules = params.SecurityRules
env.execution_environment = "aat"
env.TEST_URL = "http://rd-location-ref-data-load-aat.service.core-compute-aat.internal"
// Var for testcontainers.org
env.TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX = "hmctspublic.azurecr.io/imported/"
overrideVaultEnvironments(vaultOverrides)
loadVaultSecrets(secrets)
enableSecurityScan()
enableMutationTest()
enableFortifyScan()
afterSuccess('securityScan') {
def time = "120"
echo "Waiting ${time} seconds for deployment to complete prior starting functional testing"
sleep time.toInteger() // seconds
try {
builder.gradle('functional')
} finally {
junit '**/test-results/**/*.xml'
junit 'build/test-results/functional/**/*.xml'
archiveArtifacts 'build/reports/tests/functional/index.html'
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/functional",
reportFiles : "index.html",
reportName : "LRD Functional Test Report"
]
}
}
afterSuccess('fortify-scan') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Fortify Scan/**/*'
}
afterSuccess('mutationTest') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/**/*'
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/pitest",
reportFiles : "index.html",
reportName : "Mutation Tests Report"
]
}
}