Hydra/32: Add option to force evaluation of a certain jobset via web interface (for admins only)

This commit is contained in:
Rob Vermaas 2010-05-18 11:37:01 +00:00
parent 5e2c683f5b
commit 75bb591c03
3 changed files with 22 additions and 2 deletions

View file

@ -5,7 +5,7 @@ use warnings;
use base 'Catalyst::Controller'; use base 'Catalyst::Controller';
use Hydra::Helper::Nix; use Hydra::Helper::Nix;
use Hydra::Helper::CatalystUtils; use Hydra::Helper::CatalystUtils;
use Hydra::Helper::AddBuilds;
sub admin : Chained('/') PathPart('admin') CaptureArgs(0) { sub admin : Chained('/') PathPart('admin') CaptureArgs(0) {
my ($self, $c) = @_; my ($self, $c) = @_;
@ -86,4 +86,20 @@ sub news_delete : Chained('admin') Path('news/delete') Args(1) {
$c->res->redirect("/admin/news"); $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; 1;

View file

@ -8,7 +8,7 @@ use IPC::Run;
use Hydra::Helper::Nix; use Hydra::Helper::Nix;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(fetchInput evalJobs checkBuild inputsToArgs); our @EXPORT = qw(fetchInput evalJobs checkBuild inputsToArgs captureStdoutStderr);
sub getStorePathHash { sub getStorePathHash {

View file

@ -35,6 +35,7 @@
<th>Description</th> <th>Description</th>
<th>Last evaluated</th> <th>Last evaluated</th>
<th colspan="2">Success</th> <th colspan="2">Success</th>
[% IF c.check_user_roles('admin') %]<th>Options</th>[% END%]
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -76,6 +77,9 @@
<td align="right"> <td align="right">
<div class="[% class %]">[% j.get_column('nrsucceeded') %]/[% j.get_column('nrtotal') %]</div> <div class="[% class %]">[% j.get_column('nrsucceeded') %]/[% j.get_column('nrtotal') %]</div>
</td> </td>
[% IF c.check_user_roles('admin') %]
<td>[ [% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('force_eval'), project.name, j.name) content = "Evaluate" confirmmsg = ("Are you sure you want to force evaluation of jobset " _ project.name _ ":" _ j.name _ "?") %] ]</td>
[% END%]
</tr> </tr>
[% END %] [% END %]
</tbody> </tbody>