From c27f4bbaf599a4f7c8ea2edbbca577bd32a57fa5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 13 Aug 2013 01:56:45 +0200 Subject: [PATCH] Add a redirect from an eval to a named member E.g. /eval/798867/job/tarball redirects to the build with job name "tarball". --- src/lib/Hydra/Controller/JobsetEval.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib/Hydra/Controller/JobsetEval.pm b/src/lib/Hydra/Controller/JobsetEval.pm index 663c4b12..87742c74 100644 --- a/src/lib/Hydra/Controller/JobsetEval.pm +++ b/src/lib/Hydra/Controller/JobsetEval.pm @@ -148,4 +148,15 @@ sub nix : Chained('eval') PathPart('channel') CaptureArgs(0) { } +sub job : Chained('eval') PathPart('job') { + my ($self, $c, $job, @rest) = @_; + + my $build = $c->stash->{eval}->builds->find({job => $job}); + + notFound($c, "This evaluation has no job with the specified name.") unless defined $build; + + $c->res->redirect($c->uri_for($c->controller('Build')->action_for("build"), [$build->id], @rest)); +} + + 1;