Add a redirect to the latest finished jobset evaluation

The action .../jobset/<project>/<jobset>/latest-eval redirects to the
latest evaluation of the jobset that has no unfinished builds.  Thus,
for instance,

  http://hydra.nixos.org/jobset/nixpkgs/trunk/latest-eval/channel

is the channel containing the latest consistent set of Nixpkgs builds.
This commit is contained in:
Eelco Dolstra 2012-04-03 01:30:54 +02:00
parent 262f068e26
commit db2b2b6134

View file

@ -359,4 +359,19 @@ sub evals : Chained('jobset') PathPart('evals') Args(0) {
}
# Redirect to the latest finished evaluation of this jobset.
sub latest_eval : Chained('jobset') PathPart('latest-eval') {
my ($self, $c, @args) = @_;
my ($eval) = $c->stash->{jobset}->jobsetevals->search(
{ hasnewbuilds => 1 },
{ order_by => "id DESC", rows => 1
, where => \ "not exists (select 1 from JobsetEvalMembers m join Builds b on m.build = b.id where m.eval = me.id and b.finished = 0)"
});
notFound($c, "No evaluation found.") unless defined $eval;
my $uri = $c->uri_for($c->controller('JobsetEval')->action_for("view"), [$eval->id]);
$uri .= "/" . join("/", @args) if scalar @args > 0;
$c->res->redirect($uri);
}
1;