Allow bumping an entire evaluation to the front of the queue

This is mostly useful if we need to prioritize (say) a nixos-stable
eval that has some critical security bug fix.
This commit is contained in:
Eelco Dolstra
2015-08-10 18:56:19 +02:00
parent eb13007fe6
commit 08739a2a5a
2 changed files with 22 additions and 2 deletions

View File

@ -187,6 +187,19 @@ sub restart_aborted : Chained('eval') PathPart('restart-aborted') Args(0) {
}
sub bump : Chained('eval') PathPart('bump') Args(0) {
my ($self, $c) = @_;
requireProjectOwner($c, $c->stash->{eval}->project); # FIXME: require admin?
my $builds = $c->stash->{eval}->builds->search({ finished => 0 });
my $n = $builds->count();
$c->model('DB')->schema->txn_do(sub {
$builds->update({globalpriority => time()});
});
$c->flash->{successMsg} = "$n builds have been bumped to the front of the queue.";
$c->res->redirect($c->uri_for($c->controller('JobsetEval')->action_for('view'), $c->req->captures));
}
# Hydra::Base::Controller::NixChannel needs this.
sub nix : Chained('eval') PathPart('channel') CaptureArgs(0) {
my ($self, $c) = @_;