Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (42 sloc) 1.82 KB
pipeline {
agent any
stages {
stage('Preparation') {
steps {
slackSend color: "good", message: "Status: TERMINATING CLOUD INFRA | Job: ${env.JOB_NAME} | Build number ${env.BUILD_NUMBER} "
git 'https://github.com/vmwarecloudadvocacy/vcs-fitcycle-deployer.git'
}
}
stage('Install Dependencies') {
steps{
sh "sudo apt install wget zip python-pip -y"
sh "curl -o terraform.zip https://releases.hashicorp.com/terraform/0.11.12/terraform_0.11.12_linux_amd64.zip"
sh "unzip terraform.zip"
sh "sudo mv terraform /usr/bin"
sh "rm -rf terraform.zip"
}
}
stage('Destroy') {
environment {
TF_VAR_option_1_aws_access_key = credentials('ACCESS_KEY_ID')
TF_VAR_option_2_aws_secret_key = credentials('SECRET_KEY')
AWS_ACCESS_KEY_ID= credentials('ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY= credentials('SECRET_KEY')
}
steps {
sh "cd fitcycle_terraform/ && terraform init --backend-config=\"bucket=acme-fitcycle\" --backend-config=\"key=terraform.tfstate\" --backend-config=\"region=us-east-1\" -lock=false && terraform state pull &&terraform destroy --var-file=example_vars_files/us_west_1_mysql.tfvars --auto-approve"
}
}
}
post {
success {
slackSend color: "good", message: "Status: ${currentBuild.result} | Job: ${env.JOB_NAME} | Build number ${env.BUILD_NUMBER} "
}
failure {
slackSend color: "danger", message: "Status: ${currentBuild.result} | Job: ${env.JOB_NAME} | Build number ${env.BUILD_NUMBER} "
}
aborted {
slackSend color: "warning", message: "Status: PIPELINE ${currentBuild.result} | Job: ${env.JOB_NAME} | Build number ${env.BUILD_NUMBER}"
}
}
}
You can’t perform that action at this time.