diff --git a/src/lib/Hydra/Controller/Admin.pm b/src/lib/Hydra/Controller/Admin.pm index dd659da3..ac1a2ce4 100644 --- a/src/lib/Hydra/Controller/Admin.pm +++ b/src/lib/Hydra/Controller/Admin.pm @@ -5,7 +5,7 @@ use warnings; use base 'Catalyst::Controller'; use Hydra::Helper::Nix; use Hydra::Helper::CatalystUtils; - +use Hydra::Helper::AddBuilds; sub admin : Chained('/') PathPart('admin') CaptureArgs(0) { my ($self, $c) = @_; @@ -86,4 +86,20 @@ sub news_delete : Chained('admin') Path('news/delete') Args(1) { $c->res->redirect("/admin/news"); } +sub force_eval : Chained('admin') Path('eval') Args(2) { + my ($self, $c, $projectName, $jobsetName) = @_; + + my $project = $c->model('DB::Projects')->find($projectName) + or notFound($c, "Project $projectName doesn't exist."); + + $c->stash->{project} = $project; + $c->stash->{jobset_} = $project->jobsets->search({name => $jobsetName}); + $c->stash->{jobset} = $c->stash->{jobset_}->single + or notFound($c, "Jobset $jobsetName doesn't exist."); + + (my $res, my $stdout, my $stderr) = captureStdoutStderr(60, ("hydra_evaluator.pl", $projectName, $jobsetName)); + + $c->res->redirect("/project/$projectName"); +} + 1; diff --git a/src/lib/Hydra/Helper/AddBuilds.pm b/src/lib/Hydra/Helper/AddBuilds.pm index 889f6338..4d3dc1e0 100644 --- a/src/lib/Hydra/Helper/AddBuilds.pm +++ b/src/lib/Hydra/Helper/AddBuilds.pm @@ -8,7 +8,7 @@ use IPC::Run; use Hydra::Helper::Nix; our @ISA = qw(Exporter); -our @EXPORT = qw(fetchInput evalJobs checkBuild inputsToArgs); +our @EXPORT = qw(fetchInput evalJobs checkBuild inputsToArgs captureStdoutStderr); sub getStorePathHash { diff --git a/src/root/project.tt b/src/root/project.tt index 3237c25b..8f17852f 100644 --- a/src/root/project.tt +++ b/src/root/project.tt @@ -35,6 +35,7 @@