wip - jenkins
parent
b3942f6a47
commit
4f601a8cc0
|
|
@ -43,7 +43,7 @@ pipeline {
|
||||||
sshagent(credentials: ['sofa-user-automation']) {
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
script {
|
script {
|
||||||
|
|
||||||
sh "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${stage} "
|
sh "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} "
|
||||||
sh "terraform init"
|
sh "terraform init"
|
||||||
sh "terraform fmt"
|
sh "terraform fmt"
|
||||||
|
|
||||||
|
|
@ -53,58 +53,6 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Terraform plan') {
|
|
||||||
steps {
|
|
||||||
container('terraform') {
|
|
||||||
sshagent(credentials: ['sofa-user-automation']) {
|
|
||||||
script {
|
|
||||||
|
|
||||||
sh "cd environments/${cloud_provider}/${aws_region}/${STAGE} "
|
|
||||||
env.PLAN_STATUS = sh(script: "terraform plan -out=.terraform/plan.out -input=false -detailed-exitcode", returnStatus: true)
|
|
||||||
if (env.PLAN_STATUS == "1") {
|
|
||||||
currentBuild.result = "FAILURE"
|
|
||||||
error('Aborting the build.')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Interactive') {
|
|
||||||
when {
|
|
||||||
allOf {
|
|
||||||
expression { env.PLAN_STATUS == "2" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
timeout(time: 15, unit: "MINUTES") {
|
|
||||||
input "Is this plan acceptable?"
|
|
||||||
milestone 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage("terraform apply") {
|
|
||||||
when {
|
|
||||||
allOf {
|
|
||||||
expression { env.PLAN_STATUS == "2" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
container('terraform') {
|
|
||||||
sshagent(credentials: ['sofa-user-automation']) {
|
|
||||||
script {
|
|
||||||
sh "cd environments/${cloud_provider}/${aws_region}/${STAGE} "
|
|
||||||
sh("terraform apply -input=false .terraform/plan.out")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue