Skip to content

Instantly share code, notes, and snippets.

@rbjorklin
Created April 6, 2017 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbjorklin/0c53ff38796df2f1577699b572809776 to your computer and use it in GitHub Desktop.
Save rbjorklin/0c53ff38796df2f1577699b572809776 to your computer and use it in GitHub Desktop.
Jenkinsfile without mailing on ABORTED status
post {
failure {
echo "${currentBuild.currentResult}" // Always contains FAILURE
script {
try {
exec = currentBuild.rawBuild.getOneOffExecutor()
result = exec.abortResult().toString()
} catch (e) {
echo "${e.message}" // "Scripts not permitted to use method hudson.model.Executor abortResult"
}
if (result != 'ABORTED') {
emailext subject: "test",
body: "test",
recipientProviders: [[$class: 'FirstFailingBuildSuspectsRecipientProvider'], [$class: 'FailingTestSuspectsRecipientProvider'], [$class: 'CulpritsRecipientProvider']]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment