mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 14:02:22 +00:00
Issue number: 747
List of possible culprits for repeated failed builds should be cumulative git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@4666 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
ace3257db7
commit
2c35010120
2 files changed
+17
-11
No files matched your search
@@ -37,6 +37,7 @@ import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.mail.Address;
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
@@ -70,6 +71,8 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
|
||||
*/
|
||||
private Integer quietPeriod = null;
|
||||
|
||||
public volatile Set<User> culprits = new HashSet<User>();
|
||||
|
||||
/**
|
||||
* If this project is configured to be only built on a certain label,
|
||||
* this value will be set to that label.
|
||||
|
||||
@@ -117,6 +117,9 @@ public class MailSender<P extends AbstractProject<P, B>, B extends AbstractBuild
|
||||
appendBuildUrl(build, buf);
|
||||
msg.setText(buf.toString());
|
||||
|
||||
// Reset the list of culprits
|
||||
build.getProject().culprits.clear();
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -248,18 +251,18 @@ public class MailSender<P extends AbstractProject<P, B>, B extends AbstractBuild
|
||||
listener.getLogger().println("Trying to send e-mails to individuals who broke the build. sizeof(changeset)=="+count);
|
||||
}
|
||||
|
||||
Set<User> users = new HashSet<User>();
|
||||
for (Entry change : build.getChangeSet()) {
|
||||
User a = change.getAuthor();
|
||||
if (users.add(a)) {
|
||||
String adrs = Util.fixEmpty(a.getProperty(Mailer.UserProperty.class).getAddress());
|
||||
if(debug)
|
||||
listener.getLogger().println(" User "+a.getId()+" -> "+adrs);
|
||||
if (adrs != null)
|
||||
rcp.add(new InternetAddress(adrs));
|
||||
else {
|
||||
listener.getLogger().println("Failed to send e-mail to " + a.getFullName() + " because no e-mail address is known, and no default e-mail domain is configured");
|
||||
}
|
||||
build.getProject().culprits.add(change.getAuthor());
|
||||
}
|
||||
|
||||
for (User a : build.getProject().culprits) {
|
||||
String adrs = Util.fixEmpty(a.getProperty(Mailer.UserProperty.class).getAddress());
|
||||
if(debug)
|
||||
listener.getLogger().println(" User "+a.getId()+" -> "+adrs);
|
||||
if (adrs != null)
|
||||
rcp.add(new InternetAddress(adrs));
|
||||
else {
|
||||
listener.getLogger().println("Failed to send e-mail to " + a.getFullName() + " because no e-mail address is known, and no default e-mail domain is configured");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user