I am following Git flow: How to configure a one-click release process in Jenkins? to implement release process with Jenkins pipeline. However I am not sure what should I do to reset develop branch if something will fail.
This is a part on my pipeline stage:
try {
sh "mvn -f jgitflow:release-start -B -U -DskipTests"
try {
sh "mvn -f jgitflow:release-finish -B -U -DskipTests -Dmaven.javadoc.skip=true -DnoDeploy=false"
} catch(err) {
currentBuild.result = 'FAILURE'
println("Cannot finish a release, undoing...")
//undoing
return
}
} catch(err) {
currentBuild.result = 'FAILURE'
println("Release failed")
return
}
Should I discover a release
branch (with regexp
) and delete it, then do a git reset --hard HEAD~1
to reset a develop
branch?
Are there any other ways to do it?