forked from lix-project/hydra
Merge branch 'decl-project-remote-store'
This commit is contained in:
commit
7e3f12fe10
|
@ -68,7 +68,7 @@ sub handleDeclarativeJobsetBuild {
|
|||
my $id = $build->id;
|
||||
die "Declarative jobset build $id failed" unless $build->buildstatus == 0;
|
||||
my $declPath = ($build->buildoutputs)[0]->path;
|
||||
my $declText = read_file($declPath)
|
||||
my $declText = readNixFile($declPath)
|
||||
or die "Couldn't read declarative specification file $declPath: $!";
|
||||
my $declSpec = decode_json($declText);
|
||||
txn_do($db, sub {
|
||||
|
|
|
@ -23,7 +23,7 @@ our @EXPORT = qw(
|
|||
getEvals getMachines
|
||||
pathIsInsidePrefix
|
||||
captureStdoutStderr run grab
|
||||
getTotalShares
|
||||
getTotalShares readNixFile
|
||||
cancelBuilds restartBuilds);
|
||||
|
||||
|
||||
|
@ -390,7 +390,18 @@ sub run {
|
|||
my @x = ($args{cmd}, \$stdin, \$res->{stdout});
|
||||
push @x, \$res->{stderr} if $args{grabStderr} // 1;
|
||||
IPC::Run::run(@x,
|
||||
init => sub { chdir $args{dir} or die "changing to $args{dir}" if defined $args{dir}; });
|
||||
init => sub {
|
||||
chdir $args{dir} or die "changing to $args{dir}" if defined $args{dir};
|
||||
if (defined $args{env}) {
|
||||
foreach my $key (keys %{$args{env}}) {
|
||||
if (defined $args{env}->{$key}) {
|
||||
$ENV{$key} = $args{env}->{$key};
|
||||
} else {
|
||||
delete $ENV{$key};
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
alarm 0;
|
||||
};
|
||||
|
||||
|
@ -479,4 +490,13 @@ sub restartBuilds($$) {
|
|||
}
|
||||
|
||||
|
||||
# Read a file from the (possibly remote) nix store
|
||||
sub readNixFile {
|
||||
my ($path) = @_;
|
||||
my $config = getHydraConfig();
|
||||
my $storeUri = $config->{'store_uri'} // "";
|
||||
return grab(cmd => ["nix", "cat-store", "$path"], env => { NIX_REMOTE => "$storeUri" });
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
|
Loading…
Reference in a new issue