forked from hmcts/prl-cos-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile_CNP
123 lines (106 loc) · 4.26 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
#!groovy
import uk.gov.hmcts.contino.AppPipelineDsl
properties([
[$class: 'GithubProjectProperty', projectUrlStr: 'https://github.com/hmcts/prl-cos-api.git'],
pipelineTriggers([[$class: 'GitHubPushTrigger']])
])
@Library("Infrastructure")
def type = "java"
def product = "prl"
def component = "cos"
def channel = '#prl-tech-notifications'
// Vars for Kubernetes
env.PACT_BROKER_FULL_URL = 'https://pact-broker.platform.hmcts.net'
static Map<String, Object> secret(String secretName, String envVariable) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
envVariable: envVariable
]
}
def secrets = [
'prl-${env}':[
secret('prl-cos-idam-client-secret', 'IDAM_CLIENT_SECRET'),
secret('system-update-user-username', 'SYSTEM_UPDATE_USER_USERNAME'),
secret('system-update-user-password', 'PRL_SYSTEM_UPDATE_PASSWORD'),
secret('microservicekey-prl-cos-api', 'IDAM_S2S_AUTH_TOTP_SECRET'),
secret('notification-client-api-key', 'UK_GOV_NOTIFY_API_KEY'),
secret('test-genericpassword', 'PRL_GENERIC_PASSWORD'),
secret("launchDarkly-sdk-key", "LAUNCH_DARKLY_SDK_KEY"),
secret("AppInsightsInstrumentationKey", "APP_INSIGHTS_INSTRUMENTATION_KEY"),
secret("southampton-court-email-address", "SOUTHAMPTON_COURT_EMAIL_ADDRESS"),
secret("idam-solicitor-username", "IDAM_SOLICITOR_USERNAME"),
secret("idam-solicitor-password", "IDAM_SOLICITOR_PASSWORD"),
secret("send-grid-api-key", "SEND_GRID_API_KEY"),
secret("rpa-notify-to-email", "RPA_NOTIFY_TO_EMAIL"),
secret("rpa-notify-from-email", "RPA_NOTIFY_FROM_EMAIL"),
secret("cafcass-svc-username", "CAFCASS_USERNAME"),
secret("cafcass-svc-password", "CAFCASS_PASSWORD"),
secret("citizen-user", "IDAM_CITIZEN_USERNAME"),
secret("citizen-password", "IDAM_CITIZEN_PASSWORD"),
secret('prl-citizen-frontend-idam-client-secret', 'CITIZEN_IDAM_CLIENT_SECRET'),
secret('filtered-court-ids', 'COURT_IDS_TO_FILTER'),
secret('da-filtered-court-ids', 'DA_COURT_IDS_TO_FILTER'),
secret('ca-default-court-epimms-id', 'CA_DEFAULT_COURT_EPIMMS_ID'),
secret('welsh-court-mapping', 'WELSH_COURT_MAPPING'),
secret('judge-testuser-one', 'JUDGE_USER_NAME'),
secret('judge-testpassword', 'JUDGE_PASSWORD'),
secret("courtadmin-swansea-testuser", "IDAM_COURT_ADMIN_USERNAME"),
secret("courtadmin-swansea-testuser-password", "IDAM_COURT_ADMIN_PASSWORD")
]
]
withPipeline(type, product, component) {
pipelineConf = config;
loadVaultSecrets(secrets)
enableAksStagingDeployment()
enableSlackNotifications(channel)
disableLegacyDeployment()
afterSuccess('sonarscan') {
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/test",
reportFiles : "index.html",
reportName : "Unit Tests Report"
]
publishHTML target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "build/reports/tests/integration",
reportFiles : "index.html",
reportName : "Integration Test Report"
]
}
afterAlways('checkout') {
echo 'prl-cos-api checked out'
}
afterAlways('test') {
steps.junit '**/test-results/**/*.xml'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/**/*'
}
before('functionalTest:aat') {
env.test_environment = 'aat'
}
afterAlways('functionalTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/**/*'
}
// Kubernetes does not retrieve variables from the output terraform
before('functionalTest:preview') {
env.test_environment = 'aat'
}
afterAlways('functionalTest:preview') {
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'
enablePactAs([AppPipelineDsl.PactRoles.CONSUMER])
}
}