From 19b52e907f12efa42c816d78ee53e351acc2bb47 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 28 Oct 2015 15:04:12 +0100 Subject: [PATCH] Add action to restart all failed builds in an eval --- src/lib/Hydra/Controller/JobsetEval.pm | 18 +++++++++++++++--- src/root/jobset-eval.tt | 3 +++ 2 files changed, 18 insertions(+), 3 deletions(-) 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 %]