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: jenkinsci-users@googlegroups.com
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="mailer@1.4">
      <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 jenkinsci-users+unsubscr...@googlegroups.com.
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 jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to