[ 
https://issues.jenkins-ci.org/browse/JENKINS-5942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=159771#comment-159771
 ] 

Noah Sussman edited comment on JENKINS-5942 at 3/2/12 11:02 PM:
----------------------------------------------------------------

Fwiw, this is the workaround I am using in order to generate text and then 
email it using the Extended Email plugin.  Basically I prefix certain lines of 
the console log with a token, and then I use the Extended Email plugin's 
BUILD_LOG_REGEX feature to filter for lines that contain that token.

In my build, I generate some information and write it to a logfile called 
{{my_logfile}}.  Then I cat out the log file and prefix each line with the 
token "EMAIL:"

{noformat}
cat my_logfile | perl -lpe '$_=qq{EMAIL:\t $_}'
{noformat}

Then when in "Default Content" field of the Extended Email plugin I can say:

{noformat}
${BUILD_LOG_REGEX, regex="EMAIL:\\t (.*)", substText="$1", 
showTruncatedLines=false}
{noformat}

And that results in sending an email that contains the content of {{my_logfile}}
                
      was (Author: noahsussman):
    Fwiw, this is the workaround I am using in order to generate text and then 
email it using the Extended Email plugin.  Basically I prefix certain lines of 
the console log with a token, and then I use the Extended Email plugin's 
BUILD_LOG_REGEX feature to filter for lines that contain that token.

In my build, I generate some information and write it to a logfile called 
{{my_logfile}}.  Then I cat out the log file and prefix each line with the 
token {{EMAIL:}}

{noformat}
cat my_logfile | perl -lpe '$_=qq{EMAIL:\t $_}'
{noformat}

Then when in "Default Content" field of the Extended Email plugin I can say:

{noformat}
${BUILD_LOG_REGEX, regex="EMAIL:\\t (.*)", substText="$1", 
showTruncatedLines=false}
{noformat}

And that results in sending an email that contains the content of {{my_logfile}}
                  
> setenv variables not available to email-ext 
> --------------------------------------------
>
>                 Key: JENKINS-5942
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-5942
>             Project: Jenkins
>          Issue Type: Improvement
>          Components: email-ext
>         Environment: Hudson Setenv Plugin 1.1
> Hudson Email Extension Plugin 2.5
> hudson 1.346
>            Reporter: jminne
>
> It seems like this should work after JENKINS-3605 was fixed so I followed the 
> documented reference format as clarified in JENKINS-2413 and JENKINS-5322 
> (i.e. ${ENV, var="VERSION"} 
> I can get access to the default variables, but not ones set by setenv plugin 
> or by any build steps.  
> When this is fixed we should make sure that the recipients can be set as well 
> as the email content.
> There are a couple of related patches out there.
>   
> http://n4.nabble.com/Email-notification-recipients-as-a-variable-td1578247.html#a1578247
>   Access to node env variables: JENKINS-5465
> I'm not sure if this should be opened against email-ext or setenv plugin.
> http://wiki.jenkins-ci.org/display/JENKINS/Setenv+Plugin
> http://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin
> There is not currently a setenv component in jira so I'm opening this against 
> email-ext.
> A recent discussion of this issue:  
> http://n4.nabble.com/How-to-use-environment-variables-td1012822.html#a1012822

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to