-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
50 lines (43 loc) · 1.7 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
library(
identifier: '[email protected]',
retriever: modernSCM([$class: 'GitSCMSource',
remote: 'https://github.com/SmartColumbusOS/pipeline-lib',
credentialsId: 'jenkins-github-user'])
)
properties([
pipelineTriggers([scos.dailyBuildTrigger()]),
parameters([
booleanParam(defaultValue: false, description: 'Deploy to development environment?', name: 'DEV_DEPLOYMENT'),
string(defaultValue: 'latest', description: 'Image tag to deploy to dev environment', name: 'DEV_IMAGE_TAG')
])
])
def applicationName = "doim-adapter"
def doStageIf = scos.&doStageIf
def doStageIfDeployingToDev = doStageIf.curry(env.DEV_DEPLOYMENT == "true")
def doStageIfMergedToMaster = doStageIf.curry(scos.changeset.isMaster && env.DEV_DEPLOYMENT == "false")
def doStageIfRelease = doStageIf.curry(scos.changeset.isRelease)
node ('infrastructure') {
ansiColor('xterm') {
scos.doCheckoutStage()
doStageIfDeployingToDev('Deploy to Dev') {
deployTo(applicationName, 'dev', "--set image.tag=${env.DEV_IMAGE_TAG} --recreate-pods")
}
doStageIfMergedToMaster('Deploy to Staging') {
deployTo(applicationName, 'staging')
scos.applyAndPushGitHubTag('staging')
}
doStageIfRelease('Deploy to Production') {
deployTo(applicationName, 'prod')
scos.applyAndPushGitHubTag('prod')
}
}
}
def deployTo(applicationName, environment, extraArgs = '') {
scos.withEksCredentials(environment) {
sh("""#!/bin/bash
helm upgrade --install ${applicationName} . \
--namespace=doim \
${extraArgs}
""".trim())
}
}