Add action to restart all failed builds in an eval

This commit is contained in:
Eelco Dolstra
2015-10-28 15:04:12 +01:00
parent b9ebd38edf
commit 19b52e907f
2 changed files with 18 additions and 3 deletions

View File

@ -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?