Just checked, and it's wee a bit more convoluted. As I forgot, currentBuild.result is only set on FAILURE, hence it is actually:
post { changed { script { if (currentBuild.result == null) { mail to: NOTIFICATION_TARGET, subject: "BACK TO SUCCESS: ${currentBuild.fullDisplayName}", body: "Yay! $BUILD_URL" } } } }
PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/248 to add new fixed and regression post conditions. Not as general purpose as what you originally proposed but a lot better fit with the syntax and parsing. =)
This'll be in the upcoming Declarative 1.2.8.
Code changed in jenkins User: Andrew Bayer Path: pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/conditions/Fixed.groovy pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/conditions/Regression.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/model/conditions/Messages.properties pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BuildConditionResponderTest.java pipeline-model-definition/src/test/resources/postOnChangeChanged.groovy pipeline-model-definition/src/test/resources/postOnChangeFailed.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/3f433c84f146589c0f10c9529243ac61ec508635 Log: [FIXED JENKINS-41060] Add new fixed/regression post conditions
Wooot. Thanks Andrew!
Bulk closing resolved issues.