diff --git a/src/lib/Hydra/Controller/JobsetEval.pm b/src/lib/Hydra/Controller/JobsetEval.pm index fa1db0a1..8228ed90 100644 --- a/src/lib/Hydra/Controller/JobsetEval.pm +++ b/src/lib/Hydra/Controller/JobsetEval.pm @@ -184,16 +184,28 @@ sub cancel : Chained('evalChain') PathPart('cancel') Args(0) { } -sub restart_aborted : Chained('evalChain') PathPart('restart-aborted') Args(0) { - my ($self, $c) = @_; +sub restart { + my ($self, $c, $condition) = @_; requireProjectOwner($c, $c->stash->{eval}->project); - my $builds = $c->stash->{eval}->builds->search({ finished => 1, buildstatus => { -in => [3, 4, 9] } }); + my $builds = $c->stash->{eval}->builds->search({ finished => 1, buildstatus => $condition }); my $n = restartBuilds($c->model('DB')->schema, $builds); $c->flash->{successMsg} = "$n builds have been restarted."; $c->res->redirect($c->uri_for($c->controller('JobsetEval')->action_for('view'), $c->req->captures)); } +sub restart_aborted : Chained('evalChain') PathPart('restart-aborted') Args(0) { + my ($self, $c) = @_; + restart($self, $c, { -in => [3, 4, 9] }); +} + + +sub restart_failed : Chained('evalChain') PathPart('restart-failed') Args(0) { + my ($self, $c) = @_; + restart($self, $c, { 'not in' => [0] }); +} + + sub bump : Chained('evalChain') PathPart('bump') Args(0) { my ($self, $c) = @_; requireProjectOwner($c, $c->stash->{eval}->project); # FIXME: require admin? diff --git a/src/root/jobset-eval.tt b/src/root/jobset-eval.tt index 0380e2e5..ec0aaf5b 100644 --- a/src/root/jobset-eval.tt +++ b/src/root/jobset-eval.tt @@ -50,6 +50,9 @@ c.uri_for(c.controller('JobsetEval').action_for('view'), [% IF unfinished.size > 0 %]
  • Cancel all scheduled builds
  • [% END %] + [% IF aborted.size > 0 || stillFail.size > 0 || nowFail.size > 0 %] +
  • Restart all failed builds
  • + [% END %] [% IF aborted.size > 0 %]
  • Restart all aborted builds
  • [% END %]