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

GHA backend: support --submodules #503

Closed
RyanGlScott opened this issue Apr 7, 2021 · 7 comments · Fixed by #504
Closed

GHA backend: support --submodules #503

RyanGlScott opened this issue Apr 7, 2021 · 7 comments · Fixed by #504

Comments

@RyanGlScott
Copy link
Contributor

As nice as source-repository-packages are, there are some situations where supporting git submodules would also be nice. haskell-ci has a --submodules flag for this purpose, but at the moment the GitHub Actions backend does not support it. At first, I thought supporting this flag would be as simple as adding submodules: true to the checkout@v2 action, but when I tried this, I got this error:

The repository will be downloaded using the GitHub REST API
To create a local Git repository instead, add Git 2.18 or higher to the PATH
Error: Input 'submodules' not supported when falling back to download using the GitHub REST API. To create a local Git repository instead, add Git 2.18 or higher to the PATH.

Darn. It looks like we might have to resort to a manual git submodule update --init to do this.

@RyanGlScott
Copy link
Contributor Author

Alas, git submodule update --init doesn't appear to work either due to extremely weird behavior in an older version of git that buildpack-deps:bionic uses. See actions/checkout#335. I was only able to make things work by installing a newer version of git using an Ubuntu PPA, per the advice in this comment. If that sounds reasonable, I can open a PR.

@phadej
Copy link
Collaborator

phadej commented Apr 8, 2021

I'll be principled and say that actions/checkout should first fix their README that they require some minimal git version for some functionality. I'm not adding complexity which cannot be traced to official documentation. Issues aren't, as their preconditions may change in the future, e.g. checkout requiring newer git later on.

TL;DR, the patch should come with a link to official docs why it's made they way it is.

@RyanGlScott
Copy link
Contributor Author

The README for actions/checkout says this:

When Git 2.18 or higher is not in your PATH, falls back to the REST API to download the files.

So it's possible that the limitation really lies in GitHub's REST API, not actions/checkout itself.

@RyanGlScott
Copy link
Contributor Author

In fact, that's almost assuredly what's happening. The code in actions/checkout is using this REST endpoint to download a git repo as a tarball which is later extracted. Based off my limited experimentation with this REST API, these tarballs do not come with .git folders, so git commands (e.g., git submodule update --init) simply do not work there.

In summary, I don't see any way to make this work without upgrading the git version.

@phadej
Copy link
Collaborator

phadej commented Apr 8, 2021

Sorry, I'm not happy with additional complexity. Use ubuntu: focal. bionic's end-of-support is in two years, so maybe a good idea to give it a try.

@RyanGlScott
Copy link
Contributor Author

OK, I'd be willing to use a newer Ubuntu version. However, this poses a design question: what happens if a user tries to combine --submodules with --distribution=xenial or --distribution=bionic? Should haskell-ci throw an error? Or should it just accept whatever the user tells it?

Relatedly, https://launchpad.net/~hvr/+archive/ubuntu/ghcjs only supports Ubuntu 16.04 (Xenial) and 18.04 (Bionic), so it won't work with 20.04 (Focal). What should happen if a user tries enabling GHCJS on Focal?

@RyanGlScott
Copy link
Contributor Author

I implemented the "throw an error" design in #504.

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 a pull request may close this issue.

2 participants