Created
June 21, 2021 22:50
-
-
Save Zastai/1313008900d918e036d436513cb3baca to your computer and use it in GitHub Desktop.
This file contains 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 rollbackStage1() { | |
// big rollback code goes here | |
} | |
def rollbackStage2() { | |
// big rollback code goes here | |
} | |
def rollbackStage3() { | |
// big rollback code goes here | |
} | |
pipeline { | |
stages { | |
stage('one') { | |
steps { ... } | |
post { | |
failed { | |
script { | |
rollbackStage1() | |
} | |
} | |
} | |
} | |
stage('two') { | |
steps { ... } | |
post { | |
failed { | |
script { | |
rollbackStage2() | |
rollbackStage1() | |
} | |
} | |
} | |
} | |
stage('three') { | |
steps { ... } | |
post { | |
failed { | |
script { | |
rollbackStage3() | |
rollbackStage2() | |
rollbackStage1() | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment