-
Notifications
You must be signed in to change notification settings - Fork 6
/
Jenkinsfile_CNP
72 lines (58 loc) · 1.89 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
#!groovy
import uk.gov.hmcts.contino.GithubAPI
properties(
[[$class: 'GithubProjectProperty', projectUrlStr: 'https://github.com/hmcts/ccd-api-gateway'],
pipelineTriggers([[$class: 'GitHubPushTrigger']])]
)
@Library("Infrastructure")
def product = "ccd"
def component = "api-gateway-web"
def branchesToSync = ['demo', 'ithc', 'perftest']
// Variables to switch pipeline logic and wiring per type of build
def gatewayApiDevelopPr = "PR-332" // This doesn't change frequently, but when it does, only change this value.
def secrets = [
'ccd-${env}': [
secret('postcode-info-address-lookup-token', 'ADDRESS_LOOKUP_TOKEN'),
]
]
// Prevent Docker hub rate limit errors by ensuring that testcontainers uses images from hmctspublic ACR
env.TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX = "hmctspublic.azurecr.io/imported/"
static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[ $class: 'AzureKeyVaultSecret',
secretType: 'Secret',
name: secretName,
version: '',
envVariable: envVar
]
}
def vaultOverrides = [
'preview': 'aat',
'spreview': 'saat'
]
env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
withPipeline("nodejs", product, component) {
onMaster {
enableSlackNotifications('#ccd-master-builds')
}
if (env.BRANCH_NAME.equalsIgnoreCase(gatewayApiDevelopPr)) {
enableSlackNotifications('#ccd-develop-builds')
}
onDemo {
enableSlackNotifications('#ccd-demo-builds')
}
onPR {
enableSlackNotifications('#ccd-pr-builds')
def githubApi = new GithubAPI(this)
}
syncBranchesWithMaster(branchesToSync)
overrideVaultEnvironments(vaultOverrides)
loadVaultSecrets(secrets)
enableAksStagingDeployment()
disableLegacyDeployment()
afterAlways('checkOut') {
sh "yarn cache clean"
}
afterAlways('build') {
sh "yarn --check-cache"
}
}