generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile_CNP
103 lines (84 loc) · 2.89 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
#!groovy
@Library("Infrastructure")
import uk.gov.hmcts.contino.GradleBuilder
def type = "java"
def product = "hmc"
def component = "operational-reports-runner"
def branchesToSync = ['demo','perftest']
GradleBuilder builder = new GradleBuilder(this, product)
def secrets = [
'hmc-${env}': [
]
]
def prSecrets = [
'hmc-aat': [
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
version : '',
envVariable: envVar
]
}
withPipeline(type, product, component) {
afterAlways('test') {
// hmcts/cnp-jenkins-library may fail to copy artifacts after checkstyle error so repeat command
// (see /src/uk/gov/hmcts/contino/GradleBuilder.groovy)
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/reports/checkstyle/*.html'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/reports/pmd/*.html'
}
afterAlways('test') {
builder.gradle('integration')
}
enableAksStagingDeployment()
disableLegacyDeployment()
nonServiceApp()
syncBranchesWithMaster(branchesToSync)
onPR() {
echo "Loading PR secrets"
loadVaultSecrets(prSecrets)
env.ENV='preview'
}
onNonPR() {
echo "Loading secrets"
loadVaultSecrets(secrets)
env.ENV='aat'
}
afterAlways('akschartsinstall') {
echo "Just waiting a while to ensure that the pod has run the job"
sh "sleep 120s"
// Execute functional tests
echo "Verifying that functional test run correctly"
try {
builder.gradle('functional')
} finally {
junit '**/test-results/**/*.xml'
}
}
afterAlways('functionalTest:preview') {
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 : "hmc-operational-reports-runner Functional Test Report"
]
}
afterAlways('functionalTest:aat') {
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 : "hmc-operational-reports-runner Functional Test Report"
]
}
}