Skip to content

Commit

Permalink
Merge pull request #9526 from mlschroe/master
Browse files Browse the repository at this point in the history
[backend] maintain the history of the last failed jobs
  • Loading branch information
mlschroe authored May 19, 2020
2 parents d142103 + b53e20a commit 99ed291
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
18 changes: 12 additions & 6 deletions src/backend/BSRepServer/Checker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,18 @@ sub depstotestcaseformat {
sub addldeprepo {
my ($pool, $bconf, $ldepfile) = @_;
my $data = {};
Build::readdeps({ %$bconf }, $data, $ldepfile);
# repofromdata expects testcase format, so convert rich dependencies
if (defined &Build::Rpm::testcaseformat) {
for my $p (values %$data) {
for ('requires', 'conflicts', 'recommends', 'supplements') {
depstotestcaseformat($p->{$_}) if $p->{$_};
if (defined &Build::parse_depfile) {
my $nofiledeps = %{$bconf->{'fileprovides'} || {}} ? 0 : 1;
$data = Build::parse_depfile($ldepfile, [], 'testcaseformat' => 1, 'nofiledeps' => $nofiledeps);
$data = { map {$_ => $_} @$data }; # convert from array to hash
} else {
Build::readdeps({ %$bconf }, $data, $ldepfile);
# repofromdata expects testcase format, so convert rich dependencies
if (defined &Build::Rpm::testcaseformat) {
for my $p (values %$data) {
for ('requires', 'conflicts', 'recommends', 'supplements') {
depstotestcaseformat($p->{$_}) if $p->{$_};
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/backend/BSSched/BuildJob.pm
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,13 @@ sub addjobhist {
my $gdst = "$gctx->{'reporoot'}/$prp/$myarch";
mkdir_p($gdst);
BSFileDB::fdb_add("$gdst/:jobhistory", $BSXML::jobhistlay, $jobhist);
my $dst = "$gdst/$jobhist->{'package'}";
if ($jobhist->{'code'} eq 'failed') {
mkdir_p($dst);
BSFileDB::fdb_add_i("$dst/.failhistory", [ 'failcount', @$BSXML::jobhistlay ] , { %$jobhist });
} else {
unlink("$dst/.failhistory");
}
}


Expand Down
12 changes: 2 additions & 10 deletions src/backend/bs_repserver
Original file line number Diff line number Diff line change
Expand Up @@ -2156,16 +2156,8 @@ sub notify_jobresult {
} elsif ($jobstatus->{'result'} eq 'succeeded') {
BSNotify::notify('BUILD_SUCCESS', \%ninfo);
} else {
my $failcnt = 0;
my $filter = sub {
return 1 if ($_[0]->{'package'} ne $ninfo{'package'});
return -1 if ($_[0]->{'code'} ne 'failed');
return -1 if ($failcnt > 100);
$failcnt += 1;
return 1;
};
BSFileDB::fdb_getall_reverse("$reporoot/$prpa/:jobhistory", $BSXML::jobhistlay, undef, $filter);
$ninfo{'successive_failcount'} = $failcnt;
my $lastfail = BSFileDB::fdb_getlast("$reporoot/$prpa/$info->{'package'}/.failhistory", [ 'failcount', @$BSXML::jobhistlay ]) || {};
$ninfo{'successive_failcount'} = ($lastfail->{'failcount'} || 0);
BSNotify::notify('BUILD_FAIL', \%ninfo);
}
}
Expand Down

0 comments on commit 99ed291

Please sign in to comment.