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: 'sivaverma.da...@ncr.com' ) } 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 <sivava...@gmail.com > <javascript:>> 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 <ghazi.n...@gmail.com> 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 jenkinsci-use...@googlegroups.com. >>> >>> >>>> 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 jenkinsci-use...@googlegroups.com <javascript:>. >> 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 jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/07479b01-44b0-44c3-ae0c-f430857c3999%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.