-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile_CNP
More file actions
160 lines (139 loc) · 6.21 KB
/
Jenkinsfile_CNP
File metadata and controls
160 lines (139 loc) · 6.21 KB
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!groovy
import uk.gov.hmcts.contino.AppPipelineDsl
import uk.gov.hmcts.contino.GradleBuilder
@Library("Infrastructure")
String product = "probate"
String component = "orchestrator-service"
def secrets = [
'probate-${env}' : [
secret('s2s-probate-backend', 'S2S_AUTH_TOTP_SECRET'),
secret('probateIdamSecret', 'IDAM_SECRET'),
secret('serviceAuthProviderBaseUrl', 'SERVICE_AUTH_PROVIDER_BASE_URL'),
secret('probateUserAuthUrl', 'USER_AUTH_PROVIDER_OAUTH2_URL'),
secret('probateIdamOauthRedirectUrl', 'IDAM_OAUTH2_REDIRECT_URI'),
secret('probate-service-id', 'IDAM_CLIENT_ID'),
secret('cwUserEmail', 'CW_USER_EMAIL'),
secret('cwUserPass', 'CW_USER_PASSWORD'),
secret('launchdarkly-key', 'LAUNCHDARKLY_KEY'),
secret('launchdarklyUserkeyBackend', 'LD_USER_KEY')
]]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
version : '',
envVariable: envVar
]
}
// Configure branches to sync with master branch
def branchesToSync = ['demo', 'ithc', 'perftest']
GradleBuilder builder = new GradleBuilder(this, product)
withPipeline("java", product, component) {
loadVaultSecrets(secrets)
enableAksStagingDeployment()
disableLegacyDeployment()
enableSlackNotifications('#probate-jenkins')
env.IDAM_CLIENT="probate"
syncBranchesWithMaster(branchesToSync)
// before('buildinfra:prod') {
// error 'Deliberately breaking pipeline to prevent prod deployment.'
// }
afterSuccess('test') {
// try {
// if (env.CHANGE_BRANCH || env.BRANCH_NAME == 'master') {
// env.PACT_BROKER_URL = "pact-broker.platform.hmcts.net"
// env.PACT_BROKER_PORT = "443"
// env.PACT_BROKER_SCHEME = "https"
// env.PACT_BROKER_FULL_URL = "https://pact-broker.platform.hmcts.net"
// env.PACT_BRANCH_NAME = env.CHANGE_BRANCH
// if (env.BRANCH_NAME == 'master') {
// env.PACT_BRANCH_NAME = 'master'
// }
// // sh './gradlew pitest'
// env.PACT_BROKER_VERSION = sh(returnStdout: true, script: 'git rev-parse --verify --short HEAD')
// sh 'printenv'
// sh './gradlew runConsumerPactTests'
// sh './gradlew runProviderPactTests -Dpact.provider.version=${PACT_BROKER_VERSION}'
// sh './gradlew pactPublish'
// sh 'curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.63.0/pact-1.63.0-linux-x86_64.tar.gz'
// sh 'tar xzf pact-1.63.0-linux-x86_64.tar.gz'
// dir('pact/bin') {
// //sh './pact-broker can-i-deploy --retry-while-unknown=12 --retry-interval=10 -a probate_orchestrator_service -b ${PACT_BROKER_FULL_URL} -e ${PACT_BROKER_VERSION}'
// }
// }
// } finally {
// //steps.archiveArtifacts "build/reports/pitest/**/*.*"
// archiveArtifacts "build/reports/tests/**/*.*"
// }
junit 'build/test-results/test/**/*.xml'
archiveArtifacts 'build/reports/tests/test/index.html'
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/test",
reportFiles : "index.html",
reportName : "probate-orchestrator-service Test Report"
]
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/jacoco",
reportFiles : "index.html",
reportName : "probate-orchestrator-service Code Coverage Report"
]
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/findbugs",
reportFiles : "main.html",
reportName : "probate-orchestrator-service find Bugs Report"
]
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/integration",
reportFiles : "index.html",
reportName : "probate-submit-service integrationTest Report"
]
}
afterSuccess('functionalTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "target/site/serenity/",
reportFiles : "index.html",
reportName : "Functional Tests Report"
]
}
afterSuccess('functionalTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "target/site/serenity/",
reportFiles : "index.html",
reportName : "Functional Tests Report"
]
}
env.PACT_BROKER_FULL_URL = 'https://pact-broker.platform.hmcts.net'
onMaster() {
env.PACT_BRANCH_NAME = "master"
enablePactAs([
AppPipelineDsl.PactRoles.CONSUMER,
AppPipelineDsl.PactRoles.PROVIDER
])
}
onPR() {
enablePactAs([
AppPipelineDsl.PactRoles.CONSUMER,
AppPipelineDsl.PactRoles.PROVIDER
])
}
}