Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def awsCredentials = [[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'aws-deploy-credentials']]
- pipeline {
- agent any
- environment {
- AWS_DEFAULT_REGION = 'eu-west-1'
- }
- options {
- disableConcurrentBuilds()
- parallelsAlwaysFailFast()
- timestamps()
- withCredentials(awsCredentials)
- }
- stages {
- stage('build') {
- steps {
- sh """
- # Some commands
- echo Starting deployment.
- aws sts get-caller-identity
- """
- script {
- timeout(time: 10, unit: 'MINUTES') {
- finalStage = input message: 'What should I do next?', ok: 'Continue',
- parameters: [choice(name: 'Next stage:', choices: 'finish\nrollback\nlol', description: 'Finish will delete old version, rollback will activate the old version, abort will stop the pipeline.')]
- }
- }
- }
- }
- stage('finish') {
- when {
- expression { finalStage == 'finish' }
- }
- steps {
- sh """
- # some commands
- echo "Good! Deleting green (old) version."
- """
- }
- }
- stage('rollback') {
- when {
- expression { finalStage == 'rollback' }
- }
- steps {
- sh """
- # some commands
- echo "No problem! Rolling back to green (old) version."
- """
- }
- }
- }
- post {
- always {
- cleanWs()
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement