I have this Jenkinsfile in my repository, which is fed to Jenkins via a Multibranch pipeline job:
node { checkout scm stage("Compile") { sh "./gradlew classes" } stage("Test") { try { sh "./gradlew cleanTest test" } finally { junit "**/build/test-results/test/TEST-*.xml" } } } I need to be notified when build fails or is back to normal. I found the publishers/mailer in the DSL documentation <https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.publisher.PublisherContext.mailer> but it doesn't inside node {}, neither in the top-level scope: publishers { mailer('m...@example.com', true, true) } Lots of examples use catchErrors {} or a plain try {} finally {} and maintain the build status by hand. Is any declarative approach like publisher/mail available for my setup? I would also get rid of that try {} finally {} for junit test results processing since there is a junit publisher. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAKg%3D9UVkp5tXCkUP8a4%2B%3DDFHOqHDjbhvVYF8Oy0kXkd7xBfYgg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.