Last active
November 22, 2018 00:15
-
-
Save endofcake/9200650e330fd4c5c17e2b5001688fde to your computer and use it in GitHub Desktop.
Approve deployment to production
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
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