Skip to content

Instantly share code, notes, and snippets.

@include
Forked from endofcake/Jenkinsfile
Created November 22, 2018 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save include/db4ff96d689d942c436a840b044becbe to your computer and use it in GitHub Desktop.
Save include/db4ff96d689d942c436a840b044becbe to your computer and use it in GitHub Desktop.
Approve deployment to production
def release = false
pipeline {
agent any
options {
timestamps()
disableConcurrentBuilds()
}
parameters {
choice(choices: services, description: 'Name of the ECS service to deploy', name: 'serviceName')
choice(choices: services, description: 'Name of Docker image to update', name: 'imageName')
string(defaultValue: 'Tag to deploy', description: 'Docker image tag', name: 'tag')
}
stage("Confirm") {
when {
branch 'master'
}
options {
timeout(time: 5, unit: 'MINUTES')
}
agent none
steps {
script {
approvalMap = deploy.getSignoff('prod', 'app', "${params.serviceName} image ${params.imageName}:${params.tag}")
if (approvalMap['Release']) {
release = approvalMap['Release']
}
}
}
}
// Other deployment steps
// <...>
post {
failure {
script {
if (!release) {
currentBuild.result = "SUCCESS"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment