-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
61 lines (49 loc) · 1.85 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
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)
def doStageIfPromoted = doStageIf.curry(scos.changeset.isMaster)
node('infrastructure') {
ansiColor('xterm') {
scos.doCheckoutStage()
doStageUnlessRelease('Deploy to Dev') {
scos.withEksCredentials('dev') {
deployStrimzi()
deployKafka('dev')
}
}
doStageIfPromoted('Deploy to Staging') {
def environment = 'staging'
scos.withEksCredentials(environment) {
deployStrimzi()
deployKafka('staging')
}
scos.applyAndPushGitHubTag(environment)
}
doStageIfRelease('Deploy to Production') {
def releaseTag = env.BRANCH_NAME
def promotionTag = 'prod'
scos.withEksCredentials('prod') {
deployStrimzi()
deployKafka('prod')
}
scos.applyAndPushGitHubTag(promotionTag)
}
}
}
def deployStrimzi() {
sh "kubectl apply -f k8s/namespace.yaml"
sh "helm repo add strimzi http://strimzi.io/charts/"
sh "helm upgrade --install strimzi-kafka-operator strimzi/strimzi-kafka-operator --version 0.15.0 -f strimzi-config.yml --namespace strimzi"
}
def deployKafka(environment) {
sh "helm upgrade --install streaming-service-kafka-prime chart/ --namespace streaming-prime --timeout 600s -f chart/${environment}-values.yaml"
}