Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/lib/Hydra/Controller/Root.pm
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,24 @@ sub search :Local Args(0) {
});
}

# for a given store path basename, redirect to the first build of that store
# path
sub build_redirect :Path('build-redirect') :Args(1) {
my ($self, $c, $basename, @rest) = @_;

notFound($c, "You need to specify a /nix/store package path in the URL.") unless defined $basename;

my $storePath = "/nix/store/$basename";

# the lowest build ID will be the first build
my $build = $c->model('DB::BuildOutputs')->search(path => $storePath)->get_column('build')->min_rs->single->build;

notFound($c, "There is no successful build for /nix/store path `$storePath' to redirect to.") unless $build;

$c->res->redirect($c->uri_for($c->controller('Build')->action_for("build"),
[$build->id], @rest));
}

sub serveLogFile {
my ($c, $logPath, $tail) = @_;
$c->stash->{logPath} = $logPath;
Expand Down