Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for fetching git submodules for flakes #1356

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/script/hydra-eval-jobset
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe that each $url has a query param already (i.e. ?foo=bar), otherwise the URL (git+file://foo&submodules=1 e.g.) is probably invalid.

}
$flakeRef = $url;
}

Net::Statsd::increment("hydra.evaluator.checkouts");
Expand Down