Thanks, that works for email-ext. But there's another problem with that: 
when I enter job configuration and save the project again the 
<recipientList> element in the email-ext block in config.xml is emptied.

However, I might have found a workaround: when I set BOTH "Build Settings" 
and a "Post-build action" "Email notification" with the same variable the 
config.xml <recipients> element value stays even when I edit and save the 
project again. Now the first one tries to send email to $VARIABLE but the 
second one gets the expansion right.

The element in config.xml is the same for both: <recipients>. Is it 
possible that there's a bug in Jenkins where one configuration element 
value overwrites the other?

On Monday, May 20, 2013 5:17:11 PM UTC+3, slide wrote:
>
> For email-ext, you would use ${ENV, var="YOUR_VAR"}
>
> Sent from my Windows Phone
> ------------------------------
> From: Antti Ollilainen
> Sent: 5/20/2013 6:53
> To: [email protected] <javascript:>
> Subject: Email notification recipients are not saved
>
> Hi list,
>
> I'm having a problem with Jenkins not saving the notification email 
> recipients for a job.
>
> My setup: Jenkins 1.515 on Windows Server 2008, running standalone, 
> started as a service. The job type is a Maven 2/3 project. I am using 
> environment variables defined in Configure System --> Global Properties as 
> my email notification recipients. The browser I use is the latest Chrome 
> but the problem was same with IE10.
>
> There are two possibilities for specifying the repicipients in the job 
> configuration: a checkbox in "Build Settings" and adding a "Post-build 
> action" "Email notification".
>
> The Build Settings creates a <reporters> block in the job config.xml:
> ----
>   <reporters>
>     <hudson.maven.reporters.MavenMailer>
>       <recipients>$PROJECT1_MEMBERS</recipients>
>       <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
>       <sendToIndividuals>false</sendToIndividuals>
>       <perModuleEmail>true</perModuleEmail>
>     </hudson.maven.reporters.MavenMailer>
>   </reporters>
> ----
>
> The "recipients" value IS saved correctly when using the Build Settings 
> checkbox but environment variables are not expanded. Console log shows:
> ----
>     Sending e-mails to: $PROJECT1_MEMBERS
>     Finished: FAILURE
> ----
>
> When an email is configured by adding a Post-build action a <publishers> 
> block is created in the config.xml:
> ----
>   <publishers>
>     <hudson.tasks.Mailer plugin="[email protected]">
>       <recipients></recipients>
>       <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
>       <sendToIndividuals>false</sendToIndividuals>
>     </hudson.tasks.Mailer>
>   </publishers>
> ----
>
> As you can see the <recipients> element is empty. Of course when running a 
> job no emails are sent...
>
> The email-ext plugin is even worse: the first time I add an "Editable 
> Email Notification" as a post-build action it does save the recipient in 
> its <recipientList> element but the second time I edit the project the 
> recipients are lost... There was a bug for something similar in JIRA (
> https://issues.jenkins-ci.org/browse/JENKINS-15442) but it's marked as 
> "cannot reproduce" and closed.
>
> Is there any way I can use an environment variable as the notification 
> email recipient list in Jenkins? This is currently working in our old 
> Hudson but I'm trying to migrate to Jenkins.
>
> Best regards,
> Antti
>
> -- 
> 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:>.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>

-- 
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.


Reply via email to