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

Conversation

RichardWarfield
Copy link

Workaround/fix for 1353

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).

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).
Copy link
Member

@Ma27 Ma27 left a comment

Choose a reason for hiding this comment

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

I think a testcase for that would be nice.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants