-
Notifications
You must be signed in to change notification settings - Fork 8
/
Jenkinsfile_CNP
178 lines (149 loc) · 6.17 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!groovy
import uk.gov.hmcts.contino.AppPipelineDsl
properties(
[[$class: 'GithubProjectProperty', projectUrlStr: 'https://github.com/hmcts/ccpay-payment-app.git'],
pipelineTriggers([[$class: 'GitHubPushTrigger']])]
)
@Library("Infrastructure")
def type = "java"
def product = "payment"
def app = "api"
// Configure branches to sync with master branch
def branchesToSync = ['demo', 'ithc', 'perftest']
def vaultOverrides = [
'preview': 'aat',
'hmctsdemo': 'aat',
]
def secrets = [
'ccpay-${env}': [
secret('cmc-service-secret', 'S2S_SERVICE_SECRET'),
secret('paybubble-s2s-secret', 'PAYBUBBLE_S2S_SERVICE_SECRET'),
secret('citizen-oauth-client-secret', 'OAUTH2_CLIENT_SECRET'),
secret('freg-idam-generated-user-email-pattern', 'GENERATED_USER_EMAIL_PATTERN'),
secret('freg-idam-test-user-password', 'TEST_USER_PASSWORD'),
secret('gov-pay-keys-cmc', 'GOV_PAY_AUTH_KEY_CMC'),
secret('pci-pal-antenna-client-secret', 'PCI_PAL_ANTENNA_CLIENT_SECRET'),
secret('paybubble-idam-client-secret','IDAM_PAYBUBBLE_CLIENT_SECRET'),
secret('payment-s2s-secret','S2S_PAYMENT_APP_SERVICE_SECRET'),
secret('ref-data-professional-client-secret','IDAM_RD_PROFESSIONAL_CLIENT_SECRET'),
secret('probate-solicitor-username', 'PROBATE_SOLICITOR_USER'),
secret('probate-solicitor-password', 'PROBATE_SOLICITOR_PASSWORD')
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[ $class: 'AzureKeyVaultSecret',
secretType: 'Secret',
name: secretName,
version: '',
envVariable: envVar
]
}
// Vars for Kubernetes
env.PACT_BROKER_FULL_URL = 'https://pact-broker.platform.hmcts.net'
withPipeline(type, product, app) {
enableAksStagingDeployment()
overrideVaultEnvironments(vaultOverrides)
loadVaultSecrets(secrets)
enableDbMigration('ccpay') // for liquibase update
afterAlways('test') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "api/build/reports/checkstyle",
reportFiles : "main.html",
reportName : "CCPAY Payment App PREVIEW Application Checkstyle Main Report"
]
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "api/build/reports/checkstyle",
reportFiles : "test.html",
reportName : "CCPAY Payment App PREVIEW Test Checkstyle Test Report"
]
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "api/build/reports/checkstyle",
reportFiles : "aat.html",
reportName : "CCPAY Payment App AAT Application Checkstyle AAT Report"
]
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "api/build/reports/tests/test",
reportFiles : "index.html",
reportName : "CCPAY Payment App PREVIEW Unit Tests Report"
]
}
afterAlways('smoketest:preview') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "api/build/reports/tests/smokeTest",
reportFiles : "index.html",
reportName : "CCPAY Payment App PREVIEW Smoke Test Report"
]
}
afterAlways('smoketest:aat') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "api/build/reports/tests/smokeTest",
reportFiles : "index.html",
reportName : "CCPAY Payment App AAT Smoke Test Report"
]
}
afterAlways('functionalTest:preview') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "api/target/site/serenity",
reportFiles : "index.html",
reportName : "CCPAY Payment App PREVIEW Serenity Functional Tests"
]
}
before('functionalTest:aat') {
env.REFUND_API_URL = 'http://ccpay-refunds-api-aat.service.core-compute-aat.internal'
env.CCPAY_BULK_SCANNING_API_URL = 'http://ccpay-bulkscanning-api-aat.service.core-compute-aat.internal'
println """\
Using REFUND_API_URL: ${env.REFUND_API_URL}
Using CCPAY_BULK_SCANNING_API_URL: ${env.CCPAY_BULK_SCANNING_API_URL}""".stripIndent()
}
afterAlways('functionalTest:aat') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "api/target/site/serenity",
reportFiles : "index.html",
reportName : "CCPAY Payment App AAT Serenity Functional Tests"
]
}
//enableDockerBuild()
//installCharts()
enableSlackNotifications('#fee-pay-nightly-pipeline')
disableLegacyDeployment()
onMaster() {
enablePactAs([
AppPipelineDsl.PactRoles.CONSUMER,
AppPipelineDsl.PactRoles.PROVIDER
])
}
onPR() {
enablePactAs([
AppPipelineDsl.PactRoles.CONSUMER,
AppPipelineDsl.PactRoles.PROVIDER
])
env.REFUND_API_URL = "https://ccpay-refunds-api-payment-api-pr-${CHANGE_ID}.preview.platform.hmcts.net"
env.CCPAY_BULK_SCANNING_API_URL = "https://ccpay-bulkscanning-api-payment-api-pr-${CHANGE_ID}.preview.platform.hmcts.net"
}
//Sync demo,ithc and perftest with master branch
syncBranchesWithMaster(branchesToSync)
}