Skip to content

Instantly share code, notes, and snippets.

@tszpinda
Created January 16, 2017 09:58
Show Gist options
  • Save tszpinda/69b5b9c0f2aaf261be23198b70e1f392 to your computer and use it in GitHub Desktop.
Save tszpinda/69b5b9c0f2aaf261be23198b70e1f392 to your computer and use it in GitHub Desktop.
Jenkins 2 pipelie input example
stage('UA') {
echo 'start'
def answer = userWantToKeepCluster()
echo "will keep cluster? $answer"
echo 'done'
}
def userWantToKeepCluster() {
try {
timeout(time: 1, unit: 'MINUTES') {
def keep = input message: 'Keep cluster?',
parameters: [booleanParam(defaultValue: false, description: 'Make sure to destroy cluster manually after you done', name: 'keepCluster')]
return keep
}
} catch(e) {
return false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment