Check if we want to send email for a build before iterating through its users
Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
parent
117ae78a45
commit
93a14ccf32
|
@ -52,23 +52,23 @@ sub buildFinished {
|
|||
my %addresses;
|
||||
foreach my $b ($build, @{$dependents}) {
|
||||
my $prevBuild = getPreviousBuild($b);
|
||||
# Do we want to send mail for this build?
|
||||
unless ($ENV{'HYDRA_FORCE_SEND_MAIL'}) {
|
||||
next unless $b->jobset->enableemail;
|
||||
|
||||
# If build is cancelled or aborted, do not send email.
|
||||
next if $b->buildstatus == 4 || $b->buildstatus == 3;
|
||||
|
||||
# If there is a previous (that is not cancelled or aborted) build
|
||||
# with same buildstatus, do not send email.
|
||||
next if defined $prevBuild && ($b->buildstatus == $prevBuild->buildstatus);
|
||||
}
|
||||
|
||||
my $to = $b->jobset->emailoverride ne "" ? $b->jobset->emailoverride : $b->maintainers;
|
||||
|
||||
foreach my $address (split ",", $to) {
|
||||
$address = trim $address;
|
||||
|
||||
# Do we want to send mail for this build?
|
||||
unless ($ENV{'HYDRA_FORCE_SEND_MAIL'}) {
|
||||
next unless $b->jobset->enableemail;
|
||||
|
||||
# If build is cancelled or aborted, do not send email.
|
||||
next if $b->buildstatus == 4 || $b->buildstatus == 3;
|
||||
|
||||
# If there is a previous (that is not cancelled or aborted) build
|
||||
# with same buildstatus, do not send email.
|
||||
next if defined $prevBuild && ($b->buildstatus == $prevBuild->buildstatus);
|
||||
}
|
||||
|
||||
$addresses{$address} //= { builds => [] };
|
||||
push @{$addresses{$address}->{builds}}, $b;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue