Have you tried looking more closely at the exception 'err' to see whether they're different based on how the build was failed/aborted?
On 03.02.2016, at 17:50, Meiteimacha999 <[email protected]> wrote: > i have my workflow set up like so. This sends an email notification when a > job fails. > > > > > node("slave1") { > ws("e:\\jenkins\\workspace\\jobname\\${env.BUILD_NUMBER}") { > try{ > stage name: 'sync', concurrency: 2 > bat '''echo "before sync" > set a=%RANDOM% > echo %a% > echo "after sync"''' > sleep 10 > > stage name: 'build', concurrency: 1 > bat '''mkdir %cd%\\Build-%BUILD_NUMBER% > dir %cd% > cd %cd%\\Build-%BUILD_NUMBER% > copy /y NUL EmptyFile.txt >NUL''' > sleep 10 > > stage name: 'test', concurrency: 2 > bat '''dir %cd% > dir %cd%\\Build-%BUILD_NUMBER%''' > sleep 17 > } > > catch (err){ > stage 'Send Notification' > def msgimg="https://localhost/images/some.gif" > def newurl="${env.BUILD_URL}console" > mail (to: '[email protected]', > subject: "Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) has had an > error.", > body: "Ran on <b>${env.NODE_NAME}</b><br>job failed <a > href=${newurl}>${env.JOB_NAME}</a>. Some more message.... .<br><img > src=${msgimg} />", > mimeType:'text/html'); > currentBuild.result = 'FAILURE' > } > > } > } > > > But the issue, is i am also getting email notice for jobs that were cancelled > due to the newer job catching up with the older job while running > concurrently. I just want email notice for jobs that actually failed due to > some error and not be notified for jobs that were marked failed as they were > canceled by a presiding job. > Have anyone handled this issue? > > > > > > > > > > -- > 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/dc1ef652-5f53-44a0-94d3-4ae0626b0dfc%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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/BE663E7A-D517-4152-AC0C-7FA2CDF6279B%40beckweb.net. For more options, visit https://groups.google.com/d/optout.
