-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
32 lines (27 loc) · 902 Bytes
/
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
library(
identifier: '[email protected]',
retriever: modernSCM([$class: 'GitSCMSource',
remote: 'https://github.com/SmartColumbusOS/pipeline-lib',
credentialsId: 'jenkins-github-user'])
)
def doStageIf = scos.&doStageIf
def doStageIfRelease = doStageIf.curry(scos.changeset.isRelease)
node ('infrastructure') {
ansiColor('xterm') {
scos.doCheckoutStage()
doStageIfRelease('Deploy to Production') {
deployTo(environment: 'prod')
scos.applyAndPushGitHubTag('prod')
}
}
}
def deployTo(params = [:]) {
def environment = params.get('environment')
def extraVars = params.get('extraVars', [:])
def terraform = scos.terraform(environment)
sshagent(["GitHub"]) {
terraform.init()
}
terraform.plan(terraform.defaultVarFile, extraVars)
terraform.apply()
}