* Keep the 3 most recent builds for every platform for every job.
Previously it just kept the 3 most recent builds for every job (contrary to what the comment said).
This commit is contained in:
parent
12edc4b8e2
commit
77d4a8c027
|
@ -22,6 +22,7 @@ sub registerRoot {
|
|||
sub keepBuild {
|
||||
my ($build) = @_;
|
||||
print STDERR " keeping build ", $build->id, " (",
|
||||
$build->system, "; ",
|
||||
strftime("%Y-%m-%d %H:%M:%S", localtime($build->timestamp)), ")\n";
|
||||
if (isValidPath($build->outpath)) {
|
||||
registerRoot $build->outpath;
|
||||
|
@ -45,17 +46,21 @@ foreach my $project ($db->resultset('Projects')->all) {
|
|||
# platform.
|
||||
# !!! Take time into account? E.g. don't delete builds that
|
||||
# are younger than N days.
|
||||
my @systems = $job->builds->search({ }, { select => ["system"], distinct => 1 })->all;
|
||||
|
||||
foreach my $system (@systems) {
|
||||
my @recentBuilds = $job->builds->search(
|
||||
{ finished => 1
|
||||
, buildStatus => 0 # == success
|
||||
, system => $system->system
|
||||
},
|
||||
{ join => 'resultInfo'
|
||||
, order_by => 'timestamp DESC'
|
||||
, order_by => 'id DESC'
|
||||
, rows => 3 # !!! should make this configurable
|
||||
});
|
||||
|
||||
keepBuild $_ foreach @recentBuilds;
|
||||
}
|
||||
}
|
||||
|
||||
# Go over all views in this project.
|
||||
|
||||
|
|
Loading…
Reference in a new issue