66 lines
1.7 KiB
Groovy
66 lines
1.7 KiB
Groovy
//String cloud_provider = "aws"
|
|
//String aws_region = "eu-west-1"
|
|
//String stage = "int"
|
|
//String aws_access_credentials = "fdc_${aws_region}_${stage}_infrastructure.automation.user"
|
|
//String dynatrace_api_toke_credentials = "api_token_dynatrace_${aws_region}_${stage}"
|
|
|
|
|
|
pipeline {
|
|
agent {
|
|
node {
|
|
label 'vsds-terraform'
|
|
}
|
|
}
|
|
|
|
environment {
|
|
GIT_SSH_COMMAND = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
|
|
|
AWS_ID = credentials("${aws_access_credentials}")
|
|
AWS_ACCESS_KEY_ID = "${env.AWS_ID_USR}"
|
|
AWS_SECRET_ACCESS_KEY = "${env.AWS_ID_PSW}"
|
|
|
|
AWS_REGION = "${aws_region}"
|
|
STAGE = "${stage}"
|
|
CLOUD_PROVIDER = "${cloud_provider}"
|
|
|
|
API_TOKEN = credentials("${dynatrace_api_toke_credentials}")
|
|
TF_VAR_dt_api_token = "${env.API_TOKEN}"
|
|
}
|
|
|
|
options {
|
|
timestamps()
|
|
ansiColor('xterm')
|
|
disableConcurrentBuilds(abortPrevious: true)
|
|
timeout(time: 1, unit: 'HOURS')
|
|
}
|
|
|
|
stages {
|
|
stage('terraform init') {
|
|
steps {
|
|
sshagent(credentials: ['sofa-user-automation']) {
|
|
container('terraform') {
|
|
sh """
|
|
set -e
|
|
cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE}
|
|
terraform init
|
|
terraform fmt
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
always {
|
|
cleanWs()
|
|
|
|
script {
|
|
currentBuild.result = currentBuild.result ?: 'SUCCESS'
|
|
notifyBitbucket()
|
|
}
|
|
}
|
|
}
|
|
}
|