-
Notifications
You must be signed in to change notification settings - Fork 13
/
Jenkinsfile_parameterized
81 lines (67 loc) · 3.07 KB
/
Jenkinsfile_parameterized
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
#!groovy
@Library("Infrastructure") _
properties([
parameters([
string(name: 'PRODUCT_NAME', defaultValue: 'rd', description: ''),
string(name: 'APP', defaultValue: 'professional-api', description: 'Professional Reference Data API'),
string(name: 'TYPE', defaultValue: 'java', description: ''),
string(name: 'ENVIRONMENT', defaultValue: 'sandbox', description: 'Environment where code should be build and deployed'),
choice(name: 'SUBSCRIPTION', choices: 'sandbox\nnonprod\nprod', description: 'Azure subscriptions available to build in'),
string(name: 'S2S_URL_TO_TEST', defaultValue: 'http://rpe-service-auth-provider-sandbox.service.core-compute-sandbox.internal', description: 'S2S component URL'),
string(name: 'IDAM_URL_TO_TEST', defaultValue: 'https://idam-api.preview.platform.hmcts.net', description: 'IDAM component URL'),
string(name: 'OAUTH2_CLIENT_ID_TO_TEST', defaultValue: 'rd-professional-api', description: 'OAUTH2 client id'),
string(name: 'OAUTH2_CLIENT_SECRET_TO_TEST', defaultValue: '*****', description: 'OAUTH2 client secret'),
string(name: 'OAUTH2_REDIRECT_URI_TO_TEST', defaultValue: '*****', description: 'OAUTH2 redirect uri'),
string(name: 'S2S_SECRET_TO_TEST', defaultValue: '*****', description: 'S2S secret'),
])
])
String type = "java"
String product = "rd"
String component = "professional-api"
def secrets = [
's2s-${env}': [
secret('microservicekey-rd-professional-api', 'PROFESSIONAL_API_S2S_SECRET')
]
]
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[$class : 'AzureKeyVaultSecret',
secretType : 'Secret',
name : secretName,
version : '',
envVariable: envVar
]
}
def vaultOverrides = [
'preview' : 'aat',
'spreview': 'saat'
]
withParameterizedPipeline(type, product, component, 'sandbox', 'sandbox') {
after('smoketest:aat') {
sh "rm -rf infrastructure/"
}
overrideVaultEnvironments(vaultOverrides)
setVaultName('rd')
loadVaultSecrets(secrets)
enableDbMigration()
enableDockerBuild()
env.S2S_URL_FOR_TESTS = params.S2S_URL_TO_TEST
env.IDAM_URL = params.IDAM_URL_TO_TEST
env.OAUTH2_CLIENT_ID = params.OAUTH2_CLIENT_ID_TO_TEST
env.OAUTH2_CLIENT_SECRET = params.OAUTH2_CLIENT_SECRET_TO_TEST
env.OAUTH2_REDIRECT_URI = params.OAUTH2_REDIRECT_URI_TO_TEST
env.PROFESSIONAL_API_S2S_SECRET = params.S2S_SECRET_TO_TEST
// Var for testcontainers.org
env.TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX = "hmctspublic.azurecr.io/imported/"
after('integrationTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
}
after('integrationTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
}
after('functionalTest:preview') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
}
after('functionalTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/site/serenity/**/*'
}
}