Delete failures that have been marked for deletion once they are no
longer referenced.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/Janitor.pl | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/testbot/bin/Janitor.pl b/testbot/bin/Janitor.pl
index 618c31d022..839e1a942c 100755
--- a/testbot/bin/Janitor.pl
+++ b/testbot/bin/Janitor.pl
@@ -43,6 +43,7 @@ $Name0 =~ s+^.*/++;
use File::Path;
use WineTestBot::Config;
+use WineTestBot::Failures;
use WineTestBot::Jobs;
use WineTestBot::Log;
use WineTestBot::Patches;
@@ -193,6 +194,22 @@ if ($JobPurgeDays != 0)
}
}
+# And also failures marked for deletion
+my $Failures = CreateFailures();
+$Failures->AddFilter("BugStatus", ["deleted"]);
+foreach my $Failure (@{$Failures->GetItems()})
+{
+ if ($Failure->TaskFailures->IsEmpty())
+ {
+ $Failures->DeleteItem($Failure);
+ }
+ else
+ {
+ my $TaskFailure = @{$Failure->TaskFailures->GetItems()}[0];
+ Trace "Keeping failure ", $Failure->Id, " for task log ", join("/", $TaskFailure->JobId, $TaskFailure->StepNo, $TaskFailure->TaskNo, $TaskFailure->TaskLog), "\n";
+ }
+}
+
# Purge the deleted VMs if they are not referenced anymore
my $VMs = CreateVMs();
$VMs->AddFilter("Role", ["deleted"]);
--
2.30.2