From 08739a2a5a7a13110fff7e9ca79b8121764ebba4 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 10 Aug 2015 18:56:19 +0200 Subject: [PATCH] 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. --- src/lib/Hydra/Controller/JobsetEval.pm | 13 +++++++++++++ src/root/jobset-eval.tt | 11 +++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Controller/JobsetEval.pm b/src/lib/Hydra/Controller/JobsetEval.pm index b5314029..c0b5b0c9 100644 --- a/src/lib/Hydra/Controller/JobsetEval.pm +++ b/src/lib/Hydra/Controller/JobsetEval.pm @@ -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) = @_; diff --git a/src/root/jobset-eval.tt b/src/root/jobset-eval.tt index 48b44e87..3a090a77 100644 --- a/src/root/jobset-eval.tt +++ b/src/root/jobset-eval.tt @@ -47,8 +47,15 @@ c.uri_for(c.controller('JobsetEval').action_for('view'), [% END %]