The script isn't a template, just a script, so you don't need to use <% %>, just use groovy to do what you want, the last line of the script is used as the "return value" for the script. So, just have chgCount as the last line outside of any <% %> blocks, and don't use <% %>.
On Fri, Aug 9, 2013 at 6:51 AM, Steven Deal <stevend...@gmail.com> wrote: > Thanks for the suggestions. I think #1 would be great, although I'm not > sure I follow exactly how to do this. The documentation mentions it only > uses the last value. *'**When this is used, only the last value in the > script will be used in the expansion'* > I'm not sure I understand what this means. If I have a groovy script in my > email-templates folder named 'changes.groovy' which has a variable > 'chgCount' that holds what I want in the subject line, I would add: > > ${SCRIPT, script="changes.groovy"} to the subject line. But how will <% > chgCount %> get used? > > In my script I have <% chgCount %> on the last line (it's just set to > zero, it's not doing any processing yet as I'd just like to test getting > something into the subject line). But it's giving me a 'Error in script > or template: org.codehaus.groovy.control.MultipleCompilationErrorsException' > > I'd be so grateful if you would turn me around and point me in the right > direction. > -steven > > On Thursday, August 8, 2013 12:12:49 PM UTC-4, slide wrote: > >> There are two ways you can do this: >> >> 1) Create a groovy script in email-templates that gets the information >> and use the SCRIPT token to reference that script in your subject >> 2) Use a pre-send script to modify the subject line >> >> Either option would work, neither has any real drawbacks that I can think >> of. >> >> slide >> >> >> On Thu, Aug 8, 2013 at 9:05 AM, Steven Deal <steve...@gmail.com> wrote: >> >>> My project uses the extended email plugin. I have the content of the >>> email built from a groovy template. A recent request was to provide a quick >>> summary count of the number of files changed in the build on the subject >>> line. I don't think there's a macro for this like we have for say >>> TEST_COUNTS. >>> >>> Anyone out there know of a way to get this quickly? >>> >>> The only way I can think of would be to 1) Add a token macro like we >>> have for TEST_COUNTS, etc. (really don't want to create a patch). >>> 2) somehow get the subject field during the processing of my groovy >>> script and modify it, adding this count >>> >>> >>> -- >>> 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. >>> >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >>> >>> >> >> >> >> -- >> Website: http://earl-of-code.**com <http://earl-of-code.com> >> > -- > 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. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Website: http://earl-of-code.com -- 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. For more options, visit https://groups.google.com/groups/opt_out.