-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
65 lines (52 loc) · 2.28 KB
/
Jenkinsfile
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
library(
identifier: '[email protected]',
retriever: modernSCM([$class: 'GitSCMSource',
remote: 'https://github.com/SmartColumbusOS/pipeline-lib',
credentialsId: 'jenkins-github-user'])
)
properties([
pipelineTriggers([scos.dailyBuildTrigger()]),
])
def doStageIf = scos.&doStageIf
def doStageIfRelease = doStageIf.curry(scos.changeset.isRelease)
def doStageUnlessRelease = doStageIf.curry(!scos.changeset.isRelease && !scos.changeset.isHotfix)
def doStageIfPromoted = doStageIf.curry(scos.changeset.isMaster)
def doStageIfHotfix = doStageIf.curry(scos.changeset.isHotfix)
node('infrastructure') {
ansiColor('xterm') {
scos.doCheckoutStage()
doStageUnlessRelease('Deploy to Dev') {
deployLoggingTo('dev')
}
doStageIfPromoted('Deploy to Staging') {
deployLoggingTo('staging')
scos.applyAndPushGitHubTag('staging')
}
doStageIfRelease('Deploy to Production') {
def releaseTag = env.BRANCH_NAME
def promotionTag = 'prod'
deployLoggingTo('prod')
scos.applyAndPushGitHubTag(promotionTag)
}
}
}
def deployLoggingTo(environment) {
scos.withEksCredentials(environment) {
def terraformOutputs = scos.terraformOutput(environment)
def subnets = terraformOutputs.public_subnets.value.join(/\\,/)
def albToClusterSG = terraformOutputs.allow_all_security_group.value
def dns_zone = environment + '.internal.smartcolumbusos.com'
def certificateARN = terraformOutputs.tls_certificate_arn.value
sh("""#!/bin/bash
helm dependency update
helm upgrade --install lexlogger . \
--namespace=lexlogger \
--set global.ingress.annotations."alb\\.ingress\\.kubernetes\\.io\\/subnets"="${subnets}" \
--set global.ingress.annotations."alb\\.ingress\\.kubernetes\\.io\\/security\\-groups"="${albToClusterSG}" \
--set global.ingress.annotations."alb\\.ingress\\.kubernetes\\.io\\/certificate-arn"="${certificateARN}" \
--set kibana.ingress.hosts[0]="kibana\\.${dns_zone}" \
--values values.yaml \
--values values-curator.yaml
""".trim())
}
}