forked from lix-project/hydra
Add debug logging
This will help us track potential problems with the plugin.
This commit is contained in:
parent
986fde8888
commit
1bee6e3d8a
|
@ -93,12 +93,18 @@ sub buildFinished {
|
||||||
|
|
||||||
my $prevBuild = getPreviousBuild($b);
|
my $prevBuild = getPreviousBuild($b);
|
||||||
my $sameAsPrevious = defined $prevBuild && ($buildStatus == $prevBuild->buildstatus);
|
my $sameAsPrevious = defined $prevBuild && ($buildStatus == $prevBuild->buildstatus);
|
||||||
|
my $prevBuildStatus = (defined $prevBuild) ? $prevBuild->buildstatus : -1;
|
||||||
|
my $prevBuildId = (defined $prevBuild) ? $prevBuild->id : -1;
|
||||||
|
|
||||||
|
print STDERR "SlackNotification_Debug job name $jobName status $buildStatus (previous: $prevBuildStatus from $prevBuildId)\n";
|
||||||
|
|
||||||
foreach my $channel (@config) {
|
foreach my $channel (@config) {
|
||||||
next unless $jobName =~ /^$channel->{jobs}$/;
|
next unless $jobName =~ /^$channel->{jobs}$/;
|
||||||
|
|
||||||
my $force = $channel->{force};
|
my $force = $channel->{force};
|
||||||
|
|
||||||
|
print STDERR "SlackNotification_Debug found match with '$channel->{jobs}' with force=$force\n";
|
||||||
|
|
||||||
# If build is cancelled or aborted, do not send Slack notification.
|
# If build is cancelled or aborted, do not send Slack notification.
|
||||||
next if ! $force && $cancelledOrAborted;
|
next if ! $force && $cancelledOrAborted;
|
||||||
|
|
||||||
|
@ -106,6 +112,7 @@ sub buildFinished {
|
||||||
# with same buildstatus, do not send Slack notification.
|
# with same buildstatus, do not send Slack notification.
|
||||||
next if ! $force && $sameAsPrevious;
|
next if ! $force && $sameAsPrevious;
|
||||||
|
|
||||||
|
print STDERR "SlackNotification_Debug adding $jobName to the report list\n";
|
||||||
$channels{$channel->{url}} //= { channel => $channel, builds => [] };
|
$channels{$channel->{url}} //= { channel => $channel, builds => [] };
|
||||||
push @{$channels{$channel->{url}}->{builds}}, $b;
|
push @{$channels{$channel->{url}}->{builds}}, $b;
|
||||||
}
|
}
|
||||||
|
@ -145,6 +152,8 @@ sub buildFinished {
|
||||||
$text .= join(" or ", scalar @x > 1 ? join(", ", @x[0..scalar @x - 2]) : (), $x[-1]);
|
$text .= join(" or ", scalar @x > 1 ? join(", ", @x[0..scalar @x - 2]) : (), $x[-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print STDERR "SlackNotification_Debug POSTing to url ending with: ${\substr $url, -8}\n";
|
||||||
|
|
||||||
my $msg =
|
my $msg =
|
||||||
{ attachments =>
|
{ attachments =>
|
||||||
[{ fallback => "Job " . showJobName($build) . " build number " . $build->id . ": " . showStatus($build),
|
[{ fallback => "Job " . showJobName($build) . " build number " . $build->id . ": " . showStatus($build),
|
||||||
|
|
Loading…
Reference in a new issue