Disable channels on binary cached based Hydra instances

This commit is contained in:
Eelco Dolstra 2016-03-02 15:08:53 +01:00
parent f09b92e289
commit a74251af2b
7 changed files with 15 additions and 0 deletions

View file

@ -439,6 +439,8 @@ sub runtime_deps : Chained('buildChain') PathPart('runtime-deps') {
my $build = $c->stash->{build}; my $build = $c->stash->{build};
my @outPaths = map { $_->path } $build->buildoutputs->all; my @outPaths = map { $_->path } $build->buildoutputs->all;
requireLocalStore($c);
error($c, "Build outputs no longer available.") unless all { isValidPath($_) } @outPaths; error($c, "Build outputs no longer available.") unless all { isValidPath($_) } @outPaths;
my $done = {}; my $done = {};

View file

@ -130,6 +130,7 @@ sub metric : Chained('job') PathPart('metric') Args(1) {
# Hydra::Base::Controller::ListBuilds needs this. # Hydra::Base::Controller::ListBuilds needs this.
sub get_builds : Chained('job') PathPart('') CaptureArgs(0) { sub get_builds : Chained('job') PathPart('') CaptureArgs(0) {
my ($self, $c) = @_; my ($self, $c) = @_;
requireLocalStore($c);
$c->stash->{allBuilds} = $c->stash->{job}->builds; $c->stash->{allBuilds} = $c->stash->{job}->builds;
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJob') $c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJob')
->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name, $c->stash->{job}->name]}); ->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name, $c->stash->{job}->name]});

View file

@ -148,6 +148,7 @@ sub channels_tab : Chained('jobsetChain') PathPart('channels-tab') Args(0) {
# Hydra::Base::Controller::ListBuilds needs this. # Hydra::Base::Controller::ListBuilds needs this.
sub get_builds : Chained('jobsetChain') PathPart('') CaptureArgs(0) { sub get_builds : Chained('jobsetChain') PathPart('') CaptureArgs(0) {
my ($self, $c) = @_; my ($self, $c) = @_;
requireLocalStore($c);
$c->stash->{allBuilds} = $c->stash->{jobset}->builds; $c->stash->{allBuilds} = $c->stash->{jobset}->builds;
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJobset') $c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJobset')
->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name]}); ->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name]});

View file

@ -222,6 +222,7 @@ sub bump : Chained('evalChain') PathPart('bump') Args(0) {
# Hydra::Base::Controller::NixChannel needs this. # Hydra::Base::Controller::NixChannel needs this.
sub nix : Chained('evalChain') PathPart('channel') CaptureArgs(0) { sub nix : Chained('evalChain') PathPart('channel') CaptureArgs(0) {
my ($self, $c) = @_; my ($self, $c) = @_;
requireLocalStore($c);
$c->stash->{channelName} = $c->stash->{project}->name . "-" . $c->stash->{jobset}->name . "-latest"; $c->stash->{channelName} = $c->stash->{project}->name . "-" . $c->stash->{jobset}->name . "-latest";
$c->stash->{channelBuilds} = $c->stash->{eval}->builds $c->stash->{channelBuilds} = $c->stash->{eval}->builds
->search_literal("exists (select 1 from buildproducts where build = build.id and type = 'nix-build')") ->search_literal("exists (select 1 from buildproducts where build = build.id and type = 'nix-build')")

View file

@ -161,6 +161,7 @@ sub updateProject {
# Hydra::Base::Controller::ListBuilds needs this. # Hydra::Base::Controller::ListBuilds needs this.
sub get_builds : Chained('projectChain') PathPart('') CaptureArgs(0) { sub get_builds : Chained('projectChain') PathPart('') CaptureArgs(0) {
my ($self, $c) = @_; my ($self, $c) = @_;
requireLocalStore($c);
$c->stash->{allBuilds} = $c->stash->{project}->builds; $c->stash->{allBuilds} = $c->stash->{project}->builds;
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForProject') $c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForProject')
->search({}, {bind => [$c->stash->{project}->name]}); ->search({}, {bind => [$c->stash->{project}->name]});

View file

@ -166,6 +166,7 @@ sub machines :Local Args(0) {
# Hydra::Base::Controller::ListBuilds needs this. # Hydra::Base::Controller::ListBuilds needs this.
sub get_builds : Chained('/') PathPart('') CaptureArgs(0) { sub get_builds : Chained('/') PathPart('') CaptureArgs(0) {
my ($self, $c) = @_; my ($self, $c) = @_;
requireLocalStore($c);
$c->stash->{allBuilds} = $c->model('DB::Builds'); $c->stash->{allBuilds} = $c->model('DB::Builds');
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceeded'); $c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceeded');
$c->stash->{channelBaseName} = "everything"; $c->stash->{channelBaseName} = "everything";

View file

@ -25,6 +25,7 @@ our @EXPORT = qw(
getResponsibleAuthors getResponsibleAuthors
setCacheHeaders setCacheHeaders
approxTableSize 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; 1;