forked from hmcts/prl-dgs-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile_CNP
97 lines (80 loc) · 2.63 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
#!groovy
import uk.gov.hmcts.contino.AppPipelineDsl
properties([
[
$class : 'GithubProjectProperty',
displayName : 'Family Private Law Document Generator Client',
projectUrlStr: 'https://github.com/hmcts/prl-dgs-api'
],
pipelineTriggers([
[$class: 'GitHubPushTrigger']
])
])
@Library("Infrastructure")
def type = "java"
def product = "prl"
def component = "dgs"
def channel = '#prl-tech-notifications'
def secrets = [
'prl-${env}': [
secret("microservicekey-prl-dgs-api", "AUTH_PROVIDER_SERVICE_CLIENT_KEY"),
secret("docmosis-api-key", "DOCMOSIS_SERVICE_ACCESS_KEY"),
secret("launchDarkly-sdk-key", "LAUNCH_DARKLY_SDK_KEY"),
secret("AppInsightsInstrumentationKey", "APP_INSIGHTS_INSTRUMENTATION_KEY")
]
]
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, component) {
pipelineConf = config;
loadVaultSecrets(secrets)
enableSlackNotifications(channel)
enableAksStagingDeployment()
disableLegacyDeployment()
after('checkout') {
echo '${product}-${component} checked out'
}
after('test') {
steps.junit '**/test-results/**/*.xml'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/**/*'
}
before('smoketest:aat') {
env.test_environment = 'aat'
}
before('functionalTest:aat') {
env.test_environment = 'aat'
}
before('smoketest:preview') {
env.test_environment = 'aat'
}
// Kubernetes does not retrieve variables from the output terraform
before('functionalTest:preview') {
env.FEATURE_RESP_SOLICITOR_DETAILS = 'true'
env.test_environment = 'aat'
}
after('functionalTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/**/*'
}
after('functionalTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/**/*'
}
onMaster() {
env.ENV = 'aat'
enablePactAs([AppPipelineDsl.PactRoles.CONSUMER])
}
onPR() {
env.ENV = 'preview'
// enableCleanupOfHelmReleaseOnSuccess()
enablePactAs([AppPipelineDsl.PactRoles.CONSUMER])
}
}