Hi Siva, Did you find a solution for this? I also in need of similar use case and need to send part of console output as part of email body using a pipeline script and evaluating options of emailext plugin.
On Wednesday, 1 February 2017 10:06:56 UTC-8, slide wrote: > > body : """...""" > > You are using double quotes...use single quotes > > body : '''...''' > > On Wed, Feb 1, 2017 at 11:03 AM siva varma Datla <[email protected] > <javascript:>> wrote: > >> I am attaching the whole groovy Syntax I am using to get an email >> notification when build is started I also want to include some part of >> console log starting from Hello World to Finished Success. >> >> When I try with single quotes I end up this >> ERROR: >> >> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup >> failed: >> WorkflowScript: 17: unexpected token: BUILD_LOG_EXCERPT @ line 17, column 12. >> '<pre>${BUILD_LOG_EXCERPT, start="^Hello World", end="^Finished: >> SUCCESS"}</pre>'""", >> >> >> >> >> GROOVY SYNTAX >> >> >> node { >> echo 'Hello World' >> } >> node { >> >> notifyStarted() >> >> /* ... existing build steps ... */ >> } >> >> properties = ([data]) >> def notifyStarted() { >> 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}consoleText'>${env.JOB_NAME} >> [${env.BUILD_NUMBER}]</a>"</p>""", >> '<pre>${BUILD_LOG_EXCERPT, start="^Hello World", end="^Finished: >> SUCCESS"}</pre>' >> to: '[email protected] <javascript:>' >> ) >> } >> >> >> >> >> On Wednesday, February 1, 2017 at 12:48:47 PM UTC-5, slide wrote: >> >>> Use single quotes instead of double quotes, I don't know how else to say >>> it. >>> >>> On Wed, Feb 1, 2017 at 10:32 AM siva varma Datla <[email protected]> >>> wrote: >>> >> Can you provide me with an example please!! >>>> I would appreciate it if you do so >>>> >>>> >>>> On Wednesday, February 1, 2017 at 11:40:04 AM UTC-5, slide wrote: >>>> >>>>> If you are including this in a pipeline script, you need to make sure >>>>> and use single quotes or escape the $. Groovy will try and evaluate that >>>>> if >>>>> you use double quotes. >>>>> >>>>> On Wed, Feb 1, 2017 at 9:20 AM Ghazi TRIKI <[email protected]> >>>>> wrote: >>>>> >>>> Hello, >>>>>> >>>>>> I am helping Siva on a Jenkins build task. We wrote a pipeline email >>>>>> function that get log and puts it to email. The issue we have is that we >>>>>> tried using BUILD_LOG_EXCERPT and BUILD_LOG variables but get the >>>>>> following >>>>>> exception. Can you help us please? >>>>>> >>>>>> org.codehaus.groovy.control.MultipleCompilationErrorsException: >>>>>> startup failed: >>>>>> WorkflowScript: 17: unexpected token: BUILD_LOG_EXCERPT @ line 17, >>>>>> column 11. >>>>>> <pre>${BUILD_LOG_EXCERPT, start="^Hello World", >>>>>> end="^Finished: SUCCESS"}</pre>""", >>>>>> >>>>>> -- >>>>>> 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/aa987e90-2a58-4909-88fc-2773f666d0a2%40googlegroups.com >>>>>> >>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/aa987e90-2a58-4909-88fc-2773f666d0a2%40googlegroups.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 [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/jenkinsci-users/1246470b-2b92-455f-ba62-e3996aed8825%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/jenkinsci-users/1246470b-2b92-455f-ba62-e3996aed8825%40googlegroups.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 [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-users/07479b01-44b0-44c3-ae0c-f430857c3999%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jenkinsci-users/07479b01-44b0-44c3-ae0c-f430857c3999%40googlegroups.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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f419faca-4bae-458c-928a-6f40ba1ffd48%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
