Disable channels on binary cached based Hydra instances
This commit is contained in:
parent
f09b92e289
commit
a74251af2b
|
@ -439,6 +439,8 @@ sub runtime_deps : Chained('buildChain') PathPart('runtime-deps') {
|
|||
my $build = $c->stash->{build};
|
||||
my @outPaths = map { $_->path } $build->buildoutputs->all;
|
||||
|
||||
requireLocalStore($c);
|
||||
|
||||
error($c, "Build outputs no longer available.") unless all { isValidPath($_) } @outPaths;
|
||||
|
||||
my $done = {};
|
||||
|
|
|
@ -130,6 +130,7 @@ sub metric : Chained('job') PathPart('metric') Args(1) {
|
|||
# Hydra::Base::Controller::ListBuilds needs this.
|
||||
sub get_builds : Chained('job') PathPart('') CaptureArgs(0) {
|
||||
my ($self, $c) = @_;
|
||||
requireLocalStore($c);
|
||||
$c->stash->{allBuilds} = $c->stash->{job}->builds;
|
||||
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJob')
|
||||
->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name, $c->stash->{job}->name]});
|
||||
|
|
|
@ -148,6 +148,7 @@ sub channels_tab : Chained('jobsetChain') PathPart('channels-tab') Args(0) {
|
|||
# Hydra::Base::Controller::ListBuilds needs this.
|
||||
sub get_builds : Chained('jobsetChain') PathPart('') CaptureArgs(0) {
|
||||
my ($self, $c) = @_;
|
||||
requireLocalStore($c);
|
||||
$c->stash->{allBuilds} = $c->stash->{jobset}->builds;
|
||||
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJobset')
|
||||
->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name]});
|
||||
|
|
|
@ -222,6 +222,7 @@ sub bump : Chained('evalChain') PathPart('bump') Args(0) {
|
|||
# Hydra::Base::Controller::NixChannel needs this.
|
||||
sub nix : Chained('evalChain') PathPart('channel') CaptureArgs(0) {
|
||||
my ($self, $c) = @_;
|
||||
requireLocalStore($c);
|
||||
$c->stash->{channelName} = $c->stash->{project}->name . "-" . $c->stash->{jobset}->name . "-latest";
|
||||
$c->stash->{channelBuilds} = $c->stash->{eval}->builds
|
||||
->search_literal("exists (select 1 from buildproducts where build = build.id and type = 'nix-build')")
|
||||
|
|
|
@ -161,6 +161,7 @@ sub updateProject {
|
|||
# Hydra::Base::Controller::ListBuilds needs this.
|
||||
sub get_builds : Chained('projectChain') PathPart('') CaptureArgs(0) {
|
||||
my ($self, $c) = @_;
|
||||
requireLocalStore($c);
|
||||
$c->stash->{allBuilds} = $c->stash->{project}->builds;
|
||||
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForProject')
|
||||
->search({}, {bind => [$c->stash->{project}->name]});
|
||||
|
|
|
@ -166,6 +166,7 @@ sub machines :Local Args(0) {
|
|||
# Hydra::Base::Controller::ListBuilds needs this.
|
||||
sub get_builds : Chained('/') PathPart('') CaptureArgs(0) {
|
||||
my ($self, $c) = @_;
|
||||
requireLocalStore($c);
|
||||
$c->stash->{allBuilds} = $c->model('DB::Builds');
|
||||
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceeded');
|
||||
$c->stash->{channelBaseName} = "everything";
|
||||
|
|
|
@ -25,6 +25,7 @@ our @EXPORT = qw(
|
|||
getResponsibleAuthors
|
||||
setCacheHeaders
|
||||
approxTableSize
|
||||
requireLocalStore
|
||||
);
|
||||
|
||||
|
||||
|
@ -343,4 +344,11 @@ sub approxTableSize {
|
|||
}
|
||||
|
||||
|
||||
sub requireLocalStore {
|
||||
my ($c) = @_;
|
||||
notFound($c, "Nix channels are not supported by this Hydra server.")
|
||||
if ($c->config->{store_mode} // "direct") ne "direct";
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
|
Loading…
Reference in a new issue