Last active
December 28, 2018 06:24
-
-
Save caiges/92d60439dda8ad24f99e1b0fad5262ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent { label 'infrastructure-deployer' } | |
parameters { | |
string(name: 'ENV', description: 'The environment to deploy') | |
string(name: 'TERRAFORM_BRANCH', defaultValue: 'master', description: 'The infrastructure branch to deploy') | |
} | |
stages { | |
stage('clone infrastructure') { | |
steps { | |
checkout poll: false, scm: [$class: 'GitSCM', | |
branches: [[name: "*/${params.TERRAFORM_BRANCH}"]], | |
extensions: [[$class: 'RelativeTargetDirectory', | |
relativeTargetDir: 'infrastructure']], | |
userRemoteConfigs: [[credentialsId: 'somecreds', url: 'ssh://[email protected]:someorg/infrastructure.git']]] | |
} | |
} | |
stage('build terraform image') { | |
steps { | |
dir('bold-infrastructure/') { | |
sh 'make image' | |
} | |
} | |
} | |
stage('fetch secrets') { | |
steps{ | |
dir('bold-infrastructure') { | |
sh 'aws s3 cp s3://somebucket/somesecret somesecret' | |
} | |
} | |
} | |
stage('build environment') { | |
steps { | |
dir('bold-infrastructure') { | |
sh 'make init' | |
sh "ENV=${params.ENV} make workspace" | |
sh "ENV=${params.ENV} make apply" | |
} | |
script { | |
api_host = sh(returnStdout: true, script: "jq -r '.api_host.value' outputs.json").trim() | |
} | |
slackSend (color: '#FFFF00', message: "Deploy API HOST: ${api_host})") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment