wip - jenkins

master
Sylvain Gibier 2023-06-16 16:00:10 +02:00
parent b3942f6a47
commit 4f601a8cc0
1 changed files with 1 additions and 53 deletions

View File

@ -43,7 +43,7 @@ pipeline {
sshagent(credentials: ['sofa-user-automation']) {
script {
sh "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${stage} "
sh "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} "
sh "terraform init"
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 {