forked from lix-project/hydra
Add option eval_substituter
When using the "build" or "sysbuild" jobset input types in conjunction with a binary cache store, the evaluator needs to be able to fetch store paths from the binary cache. Typical usage: store_uri = s3://nix-test-cache?secret-key=... eval_substituter = s3://nix-test-cache Also, the public key of the binary cache must be added to binary-cache-public-keys in nix.conf, otherwise the local nix-daemon won't allow the store paths to be copied over.
This commit is contained in:
parent
a0b1875a4f
commit
5986aae704
|
@ -75,6 +75,20 @@ sub attrsToSQL {
|
|||
}
|
||||
|
||||
|
||||
# Fetch a store path from 'eval_substituter' if not already present.
|
||||
sub getPath {
|
||||
my ($path) = @_;
|
||||
return 1 if isValidPath($path);
|
||||
|
||||
my $substituter = $config->{eval_substituter};
|
||||
|
||||
system("nix", "copy", "--from", $substituter, "--", $path)
|
||||
if defined $substituter;
|
||||
|
||||
return isValidPath($path);
|
||||
}
|
||||
|
||||
|
||||
sub fetchInputBuild {
|
||||
my ($db, $project, $jobset, $name, $value) = @_;
|
||||
|
||||
|
@ -95,7 +109,7 @@ sub fetchInputBuild {
|
|||
, where => \ attrsToSQL($attrs, "me.id") })->single;
|
||||
}
|
||||
|
||||
return () if !defined $prevBuild || !isValidPath(getMainOutput($prevBuild)->path);
|
||||
return () if !defined $prevBuild || !getPath(getMainOutput($prevBuild)->path);
|
||||
|
||||
#print STDERR "input `", $name, "': using build ", $prevBuild->id, "\n";
|
||||
|
||||
|
@ -133,7 +147,7 @@ sub fetchInputSystemBuild {
|
|||
|
||||
my @validBuilds = ();
|
||||
foreach my $build (@latestBuilds) {
|
||||
push(@validBuilds, $build) if isValidPath(getMainOutput($build)->path);
|
||||
push(@validBuilds, $build) if getPath(getMainOutput($build)->path);
|
||||
}
|
||||
|
||||
if (scalar(@validBuilds) == 0) {
|
||||
|
|
Loading…
Reference in a new issue