1
0
Fork 0
mirror of https://github.com/NixOS/hydra.git synced 2024-10-17 16:37:26 -04:00

Compare commits

...

3 commits

Author SHA1 Message Date
RichardWarfield 8d3be6b48e
Merge 29fafeb1d8 into 95003f2eb5 2024-09-26 12:41:47 +00:00
RichardWarfield 29fafeb1d8
Merge branch 'NixOS:master' into flake-submodules-fix 2024-03-31 11:46:42 +07:00
Richard 096ed8ff1c Workaround for fetching git submodules for flakes
If a flake URI contains 'submodules=1' in the query part then any
submodules should be fetched/initialized.

At present, hydra-eval-jobset uses the 'url' field of the flake
metadata as the flake URI.  This URI is missing the 'submodules=1'
query, which is present elsewhere in the metadata.

This PR appends "&submodules=1" if the flake metadata indicates
submodules are used (specifically, if the resolved.submodules field
is true).
2024-02-03 07:31:57 +00:00

View file

@ -645,10 +645,16 @@ sub checkJobsetWrapped {
if (defined $flakeRef) {
(my $res, my $json, my $stderr) = captureStdoutStderr(
600, "nix", "flake", "metadata", "--refresh", "--json", "--", $flakeRef);
die "'nix flake metadata' returned " . ($res & 127 ? "signal $res" : "exit code " . ($res >> 8))
. ":\n" . ($stderr ? decode("utf-8", $stderr) : "(no output)\n")
if $res;
$flakeRef = decode_json($json)->{'url'};
my $decoded = decode_json($json);
my $url = $decoded->{'url'}; # Doesn't have the &submodules=1, so add it back if needed
if ($decoded->{'resolved'}->{'submodules'}) {
$url = $url . "&submodules=1";
}
$flakeRef = $url;
}
Net::Statsd::increment("hydra.evaluator.checkouts");