FWIW, , , try/catch/finally
. finally
, , , , finally
:
def currResult = currentBuild.result ?: 'SUCCESS'
def prevResult = currentBuild.previousBuild?.result ?: 'NOT_BUILT'
boolean isAborted = (currResult == 'ABORTED')
boolean isFailure = (currResult == 'FAILURE')
boolean isSuccess = (currResult == 'SUCCESS')
boolean isUnstable = (currResult == 'UNSTABLE')
boolean isChanged = (currResult != prevResult)
boolean isFixed = isChanged && isSuccess && (prevResult != 'ABORTED') && (prevResult != 'NOT_BUILT')
boolean isRegression = isChanged && currentBuild.resultIsWorseOrEqualTo(prevResult)
onAlways()
if (isChanged) {
onChanged()
if (isFixed) {
onFixed()
} else if (isRegression) {
onRegression()
}
}
if (isSuccess) {
onSuccess()
} else {
if (isAborted) {
onAborted()
}
onUnsuccessful()
if (isFailure) {
onFailure()
}
if (isUnstable) {
onUnstable()
}
}
onCleanup()
onXYZ()
, , , post
.