Hi Raffaele,

If you are using the 'Declarative Pipleine' syntax and you want to use 'Job 
Dsl' features, I think you should do:

jobDsl scriptText: '''publishers {
    mailer(\'[email protected]\', true, true)
}'''

** Taken from the snippet generator

hope this was helpful

בתאריך יום שני, 9 בינואר 2017 בשעה 14:44:24 UTC+2, מאת Raffaele Sgarro:
>
> 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('[email protected] <javascript:>', 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/47a59781-7eaa-4277-828b-c9edb5890a0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to