Thank you again. After a lot of trial and errors, the UserProperty problem was resolved: The class exists on the Jenkins production server, not on my simple test server. I guess it is because my test server only has the AD plugin installed but it does not use it. It uses Jenkins's own user database. Also, then "last line" trick did the trick.

But I've realized, now that this works, that I have to do this as a pre-mail script. I'd like to replace the default recipients and I'd like it not to email the Culprits and Committers if the job is claimed. So I have to edit the complete recipients list just before the mail is sent, which is a pre-send script. I'll guess I'll have to do some scripting to distribute the pre-send script to all the jobs until we can add global pre-mail scripts (JENKINS-14508).

Here's what I ended up with, for future googlers. I kept the array in case I'd like to add more recipients from other sources later.

def committers = []

build.actions.each { action ->
if(action.class.name == "hudson.plugins.claim.ClaimBuildAction" && action.isClaimed()) {
  hudson.model.User user = hudson.model.User.get(action.getClaimedBy());  
  address = user.getProperty(hudson.tasks.Mailer.UserProperty.class).address  
  committers[0]=address
}
}

// here comes the last line, it MUST be the last line for this to work!!
committers.unique().join(',')

I'd still like a built-in support for the Claim plugin, which was the initial request, so I'd prefer to leave this as open. But I'll accept a Won't Fix if you prefer that such things are resolved using the (excellent) scripting features.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" 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