This repository has been archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile_CNP
131 lines (112 loc) · 4.65 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
#!groovy
@Library("Infrastructure")
import uk.gov.hmcts.contino.AppPipelineConfig
import uk.gov.hmcts.contino.AppPipelineDsl
def type = "java"
def product = "civil-damages"
def component = "service"
AppPipelineConfig pipelineConf
static Map<String, Object> secret(String secretName, String envVariable) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
envVariable: envVariable
]
}
def secrets = [
's2s-${env}': [
secret('microservicekey-ccd-gw', 'CCD_API_GATEWAY_S2S_SECRET'),
secret('microservicekey-ccd-data', 'CCD_DATA_STORE_S2S_SECRET'),
secret('microservicekey-ccd-definition', 'CCD_DEFINITION_STORE_S2S_SECRET')
],
'ccd-${env}': [
secret('ccd-api-gateway-oauth2-client-secret', 'CCD_API_GATEWAY_IDAM_CLIENT_SECRET'),
secret('postcode-info-address-lookup-token', 'ADDRESS_LOOKUP_TOKEN')
],
'unspec-${env}': [
secret('microservicekey-unspec-service', 'S2S_SECRET'),
secret('ccd-importer-username', 'CCD_CONFIGURER_IMPORTER_USERNAME'),
secret('ccd-importer-password', 'CCD_CONFIGURER_IMPORTER_PASSWORD'),
secret('postgres-user', 'POSTGRES_USER'),
secret('postgres-password', 'POSTGRES_PASSWORD')
]
]
// Vars for Kubernetes
env.PACT_BROKER_FULL_URL = 'https://pact-broker.platform.hmcts.net'
def validateRpaContract() {
sh """ ./gradlew contract """
}
def publishRpaContract() {
env.PACT_BROKER_FULL_URL="https://pact-broker.platform.hmcts.net/"
sh """ ./gradlew pactPublish """
}
withPipeline(type, product, component) {
pipelineConf = config
disableLegacyDeployment()
enableAksStagingDeployment()
enableSlackNotifications('#unspec_notification')
onPR {
loadVaultSecrets(secrets)
}
onMaster {
loadVaultSecrets(secrets)
}
onDemo {
loadVaultSecrets(secrets)
}
before('smoketest:preview') {
validateRpaContract()
sh """
eval \$(./bin/variables/load-preview-environment-variables.sh ${CHANGE_ID})
./bin/add-roles.sh
./bin/pull-latest-release-asset.sh civil-damages-ccd-definition civil-damages-ccd-definition.zip
./bin/pull-latest-release-asset.sh civil-damages-camunda-bpmn-definition civil-damages-camunda-bpmn-definition.zip
./bin/import-ccd-definition.sh
./bin/import-bpmn-diagram.sh .
"""
env.URL="https://xui-civil-damages-service-pr-${CHANGE_ID}.service.core-compute-preview.internal"
env.UNSPEC_SERVICE_URL="http://civil-damages-service-pr-${CHANGE_ID}.service.core-compute-preview.internal"
}
after('smoketest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
}
before('functionalTest:preview') {
env.IDAM_API_URL = "https://idam-api.aat.platform.hmcts.net"
env.SERVICE_AUTH_PROVIDER_API_BASE_URL = "http://rpe-service-auth-provider-aat.service.core-compute-aat.internal"
env.CCD_DATA_STORE_URL = "http://ccd-data-store-api-civil-damages-service-pr-${CHANGE_ID}.service.core-compute-preview.internal"
env.DM_STORE_URL = "http://dm-store-aat.service.core-compute-aat.internal"
env.UNSPEC_SERVICE_URL="http://civil-damages-service-pr-${CHANGE_ID}.service.core-compute-preview.internal"
}
after('functionalTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
}
before('smoketest:aat') {
validateRpaContract()
sh """
eval \$(./bin/variables/load-staging-environment-variables.sh)
./bin/add-roles.sh
./bin/pull-latest-release-asset.sh civil-damages-ccd-definition civil-damages-ccd-definition.zip
./bin/pull-latest-release-asset.sh civil-damages-camunda-bpmn-definition civil-damages-camunda-bpmn-definition.zip
./bin/import-ccd-definition.sh
./bin/import-bpmn-diagram.sh .
"""
env.URL="https://civil-damages-service-xui-staging.aat.platform.hmcts.net"
env.UNSPEC_SERVICE_URL="http://civil-damages-service-staging.service.core-compute-aat.internal"
}
after('smoketest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
}
before('functionalTest:aat') {
env.IDAM_API_URL = "https://idam-api.aat.platform.hmcts.net"
env.SERVICE_AUTH_PROVIDER_API_BASE_URL = "http://rpe-service-auth-provider-aat.service.core-compute-aat.internal"
env.CCD_DATA_STORE_URL = "http://civil-damages-service-data-store-staging-aat.service.core-compute-aat.internal"
env.DM_STORE_URL = "http://dm-store-aat.service.core-compute-aat.internal"
env.UNSPEC_SERVICE_URL="http://civil-damages-service-staging.service.core-compute-aat.internal"
}
after('functionalTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
}
onMaster() {
enablePactAs([AppPipelineDsl.PactRoles.CONSUMER])
}
}