Thanks for your fast reply! Couple of questions...
1) Should I be putting that in Groovy brackets %> <%?
2) Am i supposed to escape the $ sign in the subsText clause?
I'm trying to get it to work but I'm getting exceptions...
Thanks!
On Friday, October 5, 2018 at 3:38:39 PM UTC-4, slide wrote:
>
> The general way to look at it is to turn the token syntax into what looks
> like a method call:
>
> ${BUILD_LOG_REGEX, regex=".*GIT COMMIT HASH = (.*)",
> showTruncatedLines=false, substText="$1"}
>
> Becomes:
>
> BUILD_LOG_REGEX(regex:".*GIT COMMIT HASH = (.*)",
> showTruncatedLines:false, substText:"$1")
>
>
>
> On Fri, Oct 5, 2018 at 12:25 PM <[email protected] <javascript:>> wrote:
>
>> I know it's been a few years :) but I have a similar question...
>>
>> How would I use the following Token Macro in a groovy template:
>>
>> Git Commit: ${BUILD_LOG_REGEX, regex=".*GIT COMMIT HASH = (.*)",
>> showTruncatedLines=false, substText="$1"}
>>
>> It works in a regular template but not groovy...
>>
>> Thanks!
>>
>> On Wednesday, July 17, 2013 at 12:18:40 PM UTC-4, slide wrote:
>>>
>>> One more thing, the email template testing should also work for Jelly
>>> templates, but I HIGHLY recommend using Groovy templates, they are MUCH
>>> better. I wish Jelly would die a horrible death after the amount of time
>>> I've put in to debugging templates :-)
>>>
>>>
>>> On Wed, Jul 17, 2013 at 9:07 AM, Michael Bukosky <[email protected]>
>>> wrote:
>>>
>>>> wow that was a simple fix. I have been racking my brain over this for
>>>> the past few days. Thanks so much for all your help.
>>>>
>>>> For reference here is my final snippet
>>>>
>>>> <dt><font color="#FFFFFF" face="Calibri,Arial"
>>>>> size="2"><strong>Cause</strong></font></dt>
>>>>> <dd><font color="#141414" face="Calibri,Arial"
>>>>> size="2">${build.causes}</font></dd>
>>>>>
>>>>> <dt><font color="#FFFFFF" face="Calibri,Arial" size="2"><strong>Build
>>>>> log extract</strong></font></dt>
>>>>> <dd><font color="#141414" face="Calibri,Arial"
>>>>> size="2">${BUILD_LOG_REGEX(matchedLineHtmlStyle:true)}</font></dd>
>>>>>
>>>>>
>>>>> <dt><font color="#FFFFFF" face="Calibri,Arial" size="2"><strong>Failed
>>>>> Tests</strong></font></dt>
>>>>> <dd><font color="#141414" face="Calibri,Arial"
>>>>> size="2">${FAILED_TESTS()}</font></dd>
>>>>
>>>>
>>>> Mike
>>>>
>>>> On Wednesday, July 17, 2013 11:56:30 AM UTC-4, slide wrote:
>>>>
>>>>> Sorry, one typo in my email, it should be
>>>>> ${BUILD_LOG_REGEX(matchedLineHtmlStyle:
>>>>> true)}. matchedLineHtmlStyle is not a boolean though, so I'm not sure why
>>>>> you are using "true" as the value.
>>>>>
>>>>>
>>>>> On Wed, Jul 17, 2013 at 8:55 AM, Slide <[email protected]> wrote:
>>>>>
>>>>>> When using macros in a groovy template, you need to use
>>>>>> ${BUILD_LOG_REGEX(matchedLineHtmlStyle=true)} and ${FAILED_TESTS()}.
>>>>>> Please give that a try. I should also be releasing a new version of
>>>>>> email-ext soon, just have some final testing to do.
>>>>>>
>>>>>>
>>>>>> On Wed, Jul 17, 2013 at 8:45 AM, Michael Bukosky <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am currently trying to write a custom build/failure email for the
>>>>>>> Jenkins - Email-ext plugin. I decided to write the email as a groovy
>>>>>>> template because of the useful 'Email Template Testing' feature in
>>>>>>> Email-ext. I would like to use a combination of groovy script and the
>>>>>>> built
>>>>>>> in Token Macros. I am having a difficult time trying to figure out if I
>>>>>>> am
>>>>>>> doing this incorrectly or if it simply is not supported. Here is a
>>>>>>> simple
>>>>>>> code snippet
>>>>>>>
>>>>>>> ... <truncated>
>>>>>>>
>>>>>>>
>>>>>>>> <dt><font color="#FFFFFF" face="Calibri,Arial"
>>>>>>>> size="2"><strong>Cause</strong></font></dt>
>>>>>>>> <dd><font color="#141414" face="Calibri,Arial"
>>>>>>>> size="2">${build.causes}</font></dd>
>>>>>>>>
>>>>>>>> <dt><font color="#FFFFFF" face="Calibri,Arial"
>>>>>>>> size="2"><strong>Build log extract</strong></font></dt>
>>>>>>>> <dd><font color="#141414" face="Calibri,Arial"
>>>>>>>> size="2">${BUILD_LOG_REGEX, matchedLineHtmlStyle=true}</font></dd>
>>>>>>>
>>>>>>>
>>>>>>>> <dt><font color="#FFFFFF" face="Calibri,Arial"
>>>>>>>> size="2"><strong>Failed Tests</strong></font></dt>
>>>>>>>
>>>>>>> <dd><font color="#141414" face="Calibri,Arial"
>>>>>>>> size="2">${FAILED_TESTS}</font></dd>
>>>>>>>
>>>>>>>
>>>>>>>> ...<truncated>
>>>>>>>
>>>>>>>
>>>>>>> After much goggling, I found a few links that support my theory that
>>>>>>> these features are not supported yet.
>>>>>>>
>>>>>>> Token Macro - https://github.com/jenkinsci/token-macro-plugin/
>>>>>>> commit/d3995df361ab9a3aed09f57da0cb6d0fdc67cbfb
>>>>>>> Token Macros via groovy (2.30.3-SNAPSHOT) - https://
>>>>>>> github.com/jenkinsci/email-ext-plugin/commit/
>>>>>>> f168dd561922254652f78f254b1bdfb8152860a8
>>>>>>>
>>>>>>> If this is truly the case, I was wondering if it would be possible
>>>>>>> to use and test the snapshop release. I am a newer user to Jenkins and
>>>>>>> have
>>>>>>> not used a snapshot before. Does anyone know how to pull the
>>>>>>> (2.30.3-SNAPSHOT) and use it in my local Jenkins?
>>>>>>>
>>>>>>> Thanks for all your help.
>>>>>>>
>>>>>>> Mike
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Website: http://earl-of-code.com
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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 [email protected].
>>>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/3d4db1a4-e2e7-42b9-85d9-0fc4760bb1ef%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/jenkinsci-users/3d4db1a4-e2e7-42b9-85d9-0fc4760bb1ef%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/7f845b45-fdcd-45cc-9447-d502a1439125%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.