Add a redirect to the latest view result for which the underlying evaluation has finished completely

This will be useful for the Nixpkgs channel mirror script:

  http://hydra.nixos.org/view/nixpkgs/unstable/latest-finished/channel

is the channel containing the latest, consistent, tested set of builds.
This commit is contained in:
Eelco Dolstra
2012-04-03 17:45:03 +02:00
parent bd93ca9316
commit f52ca0c588
3 changed files with 23 additions and 4 deletions

View File

@ -222,10 +222,16 @@ sub getViewResult {
sub getLatestSuccessfulViewResult {
my ($project, $primaryJob, $jobs) = @_;
my ($project, $primaryJob, $jobs, $finished) = @_;
my $latest;
foreach my $build (getPrimaryBuildsForView($project, $primaryJob)) {
return $build if getViewResult($build, $jobs)->{status} == 0;
my $result = getViewResult($build, $jobs);
next if $result->{status} != 0;
if ($finished) {
next unless defined $result->{eval};
next if $result->{eval}->builds->search({ finished => 0 })->count > 0;
}
return $build;
}
return undef;
}