RE: Email notification recipients are not saved

404 views
Skip to first unread message

Alex Earl

unread,
May 20, 2013, 10:17:11 AM5/20/13
to Antti Ollilainen, jenkins...@googlegroups.com
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: jenkins...@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-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Antti Ollilainen

unread,
May 21, 2013, 1:39:34 AM5/21/13
to jenkins...@googlegroups.com
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?

Alex Earl

unread,
May 21, 2013, 2:03:58 AM5/21/13
to Antti Ollilainen, jenkins...@googlegroups.com
I don't know what "Build Settings" is, what type of job are you using? Free style? Maven? Something else? Also, can you remind me what version of Jenkins you are using?


Sent from my Windows Phone

From: Antti Ollilainen
Sent: 5/20/2013 22:39
To: jenkins...@googlegroups.com
Subject: Re: Email notification recipients are not saved

Antti Ollilainen

unread,
May 21, 2013, 2:11:24 AM5/21/13
to jenkins...@googlegroups.com, Antti Ollilainen
It's 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 the email notification recipients. I've tried this with the latest Chrome and IE10.

Alex Earl

unread,
May 21, 2013, 2:13:42 AM5/21/13
to Antti Ollilainen, jenkins...@googlegroups.com
Can you upload you global and job config XML files somewhere?


Sent from my Windows Phone

From: Antti Ollilainen
Sent: 5/20/2013 23:11
To: jenkins...@googlegroups.com
Cc: Antti Ollilainen
Reply all
Reply to author
Forward
0 new messages