* 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:
Eelco Dolstra 2010-02-15 10:21:11 +00:00
parent 12edc4b8e2
commit 77d4a8c027

View file

@ -22,7 +22,8 @@ sub registerRoot {
sub keepBuild { sub keepBuild {
my ($build) = @_; my ($build) = @_;
print STDERR " keeping build ", $build->id, " (", print STDERR " keeping build ", $build->id, " (",
strftime("%Y-%m-%d %H:%M:%S", localtime($build->timestamp)), ")\n"; $build->system, "; ",
strftime("%Y-%m-%d %H:%M:%S", localtime($build->timestamp)), ")\n";
if (isValidPath($build->outpath)) { if (isValidPath($build->outpath)) {
registerRoot $build->outpath; registerRoot $build->outpath;
} else { } else {
@ -45,16 +46,20 @@ foreach my $project ($db->resultset('Projects')->all) {
# platform. # platform.
# !!! Take time into account? E.g. don't delete builds that # !!! Take time into account? E.g. don't delete builds that
# are younger than N days. # are younger than N days.
my @recentBuilds = $job->builds->search( my @systems = $job->builds->search({ }, { select => ["system"], distinct => 1 })->all;
{ finished => 1
, buildStatus => 0 # == success
},
{ join => 'resultInfo'
, order_by => 'timestamp DESC'
, rows => 3 # !!! should make this configurable
});
keepBuild $_ foreach @recentBuilds; foreach my $system (@systems) {
my @recentBuilds = $job->builds->search(
{ finished => 1
, buildStatus => 0 # == success
, system => $system->system
},
{ join => 'resultInfo'
, order_by => 'id DESC'
, rows => 3 # !!! should make this configurable
});
keepBuild $_ foreach @recentBuilds;
}
} }
# Go over all views in this project. # Go over all views in this project.