node {
checkout scm
stage("Compile") {
sh "./gradlew classes"
}
stage("Test") {
try {
sh "./gradlew cleanTest test"
} finally {
junit "**/build/test-results/test/TEST-*.xml"
}
}
}publishers {
mailer('m...@example.com', true, true)
}Hi Ohad! As I understand from your kind message, the job DSL is not available in a Jenkinsfile. The jobDsl trick is clearly a hack and I prefer keeping it simple, even if try-finally and if-else constructs don't really belong to a declarative way of describing a pipeline.May I ask if you think this (configuring the mailer publisher via stage([$class: 'Mailer'])) is intended or just not implemented yet?
--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/58191228-334c-45e0-84eb-f602a2105792%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The problem is that both Mailer and Email-ext require wrapping steps inside a try/catch or equivalent. I already use Mailer activated by the catchError trigger, but hoped to find a declarative solution because loops and branches are too scripty for a Jenkinsfile in my opinion (I don't want, should not need and definitely don't know how to test pipeline files).
However this is how things work and I guess there must be valid reasons for it. Thanks for your support!
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/VWnkOYPOKTA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVeMFGbn-NYmS_%3DSzTa7mV8bZCRVoVDeextBMWLFV7ih%2Bw%40mail.gmail.com.