forked from lix-project/hydra
restart/cancelBuilds: always pass resultsets explicitly
This commit is contained in:
parent
592fef9d82
commit
ffedbe5996
|
@ -32,7 +32,7 @@ sub machines : Chained('admin') PathPart('machines') Args(0) {
|
||||||
|
|
||||||
sub clear_queue_non_current : Chained('admin') PathPart('clear-queue-non-current') Args(0) {
|
sub clear_queue_non_current : Chained('admin') PathPart('clear-queue-non-current') Args(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
my $builds = $c->model('DB::Builds')->search(
|
my $builds = $c->model('DB::Builds')->search_rs(
|
||||||
{ id => { -in => \ "select id from Builds where id in ((select id from Builds where finished = 0) except (select build from JobsetEvalMembers where eval in (select max(id) from JobsetEvals where hasNewBuilds = 1 group by jobset_id)))" }
|
{ id => { -in => \ "select id from Builds where id in ((select id from Builds where finished = 0) except (select build from JobsetEvalMembers where eval in (select max(id) from JobsetEvals where hasNewBuilds = 1 group by jobset_id)))" }
|
||||||
});
|
});
|
||||||
my $n = cancelBuilds($c->model('DB')->schema, $builds);
|
my $n = cancelBuilds($c->model('DB')->schema, $builds);
|
||||||
|
|
|
@ -487,7 +487,7 @@ sub restart : Chained('buildChain') PathPart Args(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
my $build = $c->stash->{build};
|
my $build = $c->stash->{build};
|
||||||
requireRestartPrivileges($c, $build->project);
|
requireRestartPrivileges($c, $build->project);
|
||||||
my $n = restartBuilds($c->model('DB')->schema, $c->model('DB::Builds')->search({ id => $build->id }));
|
my $n = restartBuilds($c->model('DB')->schema, $c->model('DB::Builds')->search_rs({ id => $build->id }));
|
||||||
error($c, "This build cannot be restarted.") if $n != 1;
|
error($c, "This build cannot be restarted.") if $n != 1;
|
||||||
$c->flash->{successMsg} = "Build has been restarted.";
|
$c->flash->{successMsg} = "Build has been restarted.";
|
||||||
$c->res->redirect($c->uri_for($self->action_for("build"), $c->req->captures));
|
$c->res->redirect($c->uri_for($self->action_for("build"), $c->req->captures));
|
||||||
|
@ -498,7 +498,7 @@ sub cancel : Chained('buildChain') PathPart Args(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
my $build = $c->stash->{build};
|
my $build = $c->stash->{build};
|
||||||
requireCancelBuildPrivileges($c, $build->project);
|
requireCancelBuildPrivileges($c, $build->project);
|
||||||
my $n = cancelBuilds($c->model('DB')->schema, $c->model('DB::Builds')->search({ id => $build->id }));
|
my $n = cancelBuilds($c->model('DB')->schema, $c->model('DB::Builds')->search_rs({ id => $build->id }));
|
||||||
error($c, "This build cannot be cancelled.") if $n != 1;
|
error($c, "This build cannot be cancelled.") if $n != 1;
|
||||||
$c->flash->{successMsg} = "Build has been cancelled.";
|
$c->flash->{successMsg} = "Build has been cancelled.";
|
||||||
$c->res->redirect($c->uri_for($self->action_for("build"), $c->req->captures));
|
$c->res->redirect($c->uri_for($self->action_for("build"), $c->req->captures));
|
||||||
|
|
|
@ -153,7 +153,7 @@ sub cancel : Chained('evalChain') PathPart('cancel') Args(0) {
|
||||||
sub restart {
|
sub restart {
|
||||||
my ($self, $c, $condition) = @_;
|
my ($self, $c, $condition) = @_;
|
||||||
requireRestartPrivileges($c, $c->stash->{project});
|
requireRestartPrivileges($c, $c->stash->{project});
|
||||||
my $builds = $c->stash->{eval}->builds->search({ finished => 1, buildstatus => $condition });
|
my $builds = $c->stash->{eval}->builds->search_rs({ finished => 1, buildstatus => $condition });
|
||||||
my $n = restartBuilds($c->model('DB')->schema, $builds);
|
my $n = restartBuilds($c->model('DB')->schema, $builds);
|
||||||
$c->flash->{successMsg} = "$n builds have been restarted.";
|
$c->flash->{successMsg} = "$n builds have been restarted.";
|
||||||
$c->res->redirect($c->uri_for($c->controller('JobsetEval')->action_for('view'), $c->req->captures));
|
$c->res->redirect($c->uri_for($c->controller('JobsetEval')->action_for('view'), $c->req->captures));
|
||||||
|
|
Loading…
Reference in a new issue