I tried replacing my code with that produced by the snippet generator: script{ emailext (body: '${DEFAULT_CONTENT}', recipientProviders: [[$class: 'CulpritsRecipientProvider']], subject: '${DEFAULT_SUBJECT}', to: 'daldrich') }
But the result is an email to daldrich but not to the culprits. Could this be a bug in the emailext plugin? BR David From: jenkinsci-users@googlegroups.com [mailto:jenkinsci-users@googlegroups.com] On Behalf Of David Aldrich Sent: 17 May 2017 08:53 To: jenkinsci-users@googlegroups.com Subject: RE: How to specify recipients in email-ext step in declarative script? Hi Slide I think the script is still not quite right. I now have: post { success { script{ def recipients = emailextrecipients([ [$class: 'DevelopersRecipientProvider'] ]) emailext (to: "daldrich," + recipients, subject: '${DEFAULT_SUBJECT}', body: '${DEFAULT_CONTENT}', recipientProviders: [[$class: 'DevelopersRecipientProvider']]) } } } I see two problems: 1) The output shows: Failed to create e-mail address for co...@us.com<mailto:co...@us.com> co...@us.com<mailto:co...@us.com> co...@us.com<mailto:co...@us.com> Sending email to: co...@us.com<mailto:co...@us.com> co...@us.com<mailto:co...@us.com> co...@us.com<mailto:co...@us.com> These are the correct committers’ email addresses but I have disguised them for this question. I receive an email but I don’t know why I see the ‘Failed’ message in the log. Any ideas please? 2) The subject uses : '${DEFAULT_SUBJECT}', which ends with ‘$BUILD_STATUS!’ In the received email the build status was ‘Building!’. This is in ‘post’ so I expect the status to be ‘Success!’. Any idea why this is wrong? Best regards David From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> [mailto:jenkinsci-users@googlegroups.com] On Behalf Of David Aldrich Sent: 16 May 2017 17:02 To: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> Subject: RE: How to specify recipients in email-ext step in declarative script? Thanks Slide David From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> [mailto:jenkinsci-users@googlegroups.com] On Behalf Of Slide Sent: 16 May 2017 16:38 To: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> Subject: Re: How to specify recipients in email-ext step in declarative script? to: "daldrich," + recipients Also, you may be missing a '}' to close the script block. On Tue, May 16, 2017 at 7:12 AM David Aldrich <david.aldr...@emea.nec.com<mailto:david.aldr...@emea.nec.com>> wrote: Hi Slide Thanks. I tried the code below based on your suggestion but the syntax of my change isn’t quite right. Can you help please? post { success { script{ def recipients = emailextrecipients([ [$class: 'DevelopersRecipientProvider'] ]) emailext (to: "daldrich"; recipients, subject: '${DEFAULT_SUBJECT}', body: '${DEFAULT_CONTENT}', recipientProviders: [[$class: 'DevelopersRecipientProvider']]) } } org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: WorkflowScript: 13: expecting ')', found ',' @ line 13, column 57. xt (to: "daldrich"; recipients, ^ 1 error From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> [mailto:jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>] On Behalf Of Slide Sent: 16 May 2017 14:39 To: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> Subject: Re: How to specify recipients in email-ext step in declarative script? Something like this might work: script { def recipients = emailextrecipients([ [$class: 'DevelopersRecipientProvider'] ]) emailext(..., to: recipients) } On Tue, May 16, 2017 at 6:18 AM David Aldrich <david.aldr...@emea.nec.com<mailto:david.aldr...@emea.nec.com>> wrote: Hi Danny, That worked (with email addresses in quotes) – thanks. Do you know how I would specify ‘to:’ as a certain email address + committers? Best regards David From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> [mailto:jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>] On Behalf Of Danny Rehelis Sent: 16 May 2017 14:08 To: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> Subject: Re: How to specify recipients in email-ext step in declarative script? Hey David, This should be pretty straightforward, try this: post { success { emailext ( to: a...@me.com<mailto:a...@me.com>; a...@him.com<mailto:a...@him.com>, subject: "SUCCESS", body: "SUCCESS!" ) } failure { emailext ( to: a...@me.com<mailto:a...@me.com>; a...@him.com<mailto:a...@him.com>, subject: "FAILURE", body: "FAILURE!" ) } } On Tue, May 16, 2017 at 11:25 AM David Aldrich <david.aldr...@emea.nec.com<mailto:david.aldr...@emea.nec.com>> wrote: Hi I am experimenting with declarative scripts and have this simple script: pipeline { agent { label "mypc" } stages { stage('build') { steps { sh 'python --version' } } } post { success { script: emailext (subject: "STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", body: """<p>STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p> <p>Check console output at "<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""", recipientProviders: [$class: 'DevelopersRecipientProvider']]) } } } I can’t specify the list of default recipients in the global settings for the email-ext plugin, as the required recipients change from project to project. I need to specify the list in the script. I’ve received a suggestion to: “use this pipeline step https://jenkins.io/doc/pipeline/steps/email-ext/#emailextrecipients-extended-email-recipients to get the recipients and then use the "to" parameter to the emailext step and add your own addresses to the return of that step” I don’t know how to do this. Please could someone show me how to modify my script to do it? Best regards David -- 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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/21c2aac48caa41998f52a2e233d4ed76%40EUX13SRV1.EU.NEC.COM<https://groups.google.com/d/msgid/jenkinsci-users/21c2aac48caa41998f52a2e233d4ed76%40EUX13SRV1.EU.NEC.COM?utm_medium=email&utm_source=footer>. 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 jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAObRFCX0ZaN4MPqiNy9tB8z0nr_g1zFrZ1Ssa24Bhb997G7p4A%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CAObRFCX0ZaN4MPqiNy9tB8z0nr_g1zFrZ1Ssa24Bhb997G7p4A%40mail.gmail.com?utm_medium=email&utm_source=footer>. For more options, visit https://groups.google.com/d/optout. Click here<https://www.mailcontrol.com/sr/uFEKaVH2kQrGX2PQPOmvUmQbZlJUA6MY5kXy3PWbkPYgGJ5pIgYGc+W6EUrkl!zFSQHHbCeqo0cKghm6!2a+jw==> to report this email as spam. -- 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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1ba2614920ab4f01a957692fe395146e%40EUX13SRV1.EU.NEC.COM<https://groups.google.com/d/msgid/jenkinsci-users/1ba2614920ab4f01a957692fe395146e%40EUX13SRV1.EU.NEC.COM?utm_medium=email&utm_source=footer>. 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 jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVetEq5qDryWrRDS85Xg2uTtcFtbeo1sn97F15DD%3DPM7ZA%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVetEq5qDryWrRDS85Xg2uTtcFtbeo1sn97F15DD%3DPM7ZA%40mail.gmail.com?utm_medium=email&utm_source=footer>. 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 jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0469c2cb3fe64a4ab024f74c10d4b214%40EUX13SRV1.EU.NEC.COM<https://groups.google.com/d/msgid/jenkinsci-users/0469c2cb3fe64a4ab024f74c10d4b214%40EUX13SRV1.EU.NEC.COM?utm_medium=email&utm_source=footer>. 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 jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVe-KveLCY%2BcJDM3C-eb8ZwqtUaAhjBd_T4wZ2Sakiwo9g%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVe-KveLCY%2BcJDM3C-eb8ZwqtUaAhjBd_T4wZ2Sakiwo9g%40mail.gmail.com?utm_medium=email&utm_source=footer>. 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 jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1b7a1ef389fa4e48bbf39dce8f8f8550%40EUX13SRV1.EU.NEC.COM<https://groups.google.com/d/msgid/jenkinsci-users/1b7a1ef389fa4e48bbf39dce8f8f8550%40EUX13SRV1.EU.NEC.COM?utm_medium=email&utm_source=footer>. 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 jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/28f1e4b702d3473daea012b34b77b861%40EUX13SRV1.EU.NEC.COM<https://groups.google.com/d/msgid/jenkinsci-users/28f1e4b702d3473daea012b34b77b861%40EUX13SRV1.EU.NEC.COM?utm_medium=email&utm_source=footer>. 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 jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4b69f78cd1054bd084bfd6371bebf993%40EUX13SRV1.EU.NEC.COM. For more options, visit https://groups.google.com/d/optout.