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

Git error since using opam 2.3.0 #895

Open
sim642 opened this issue Nov 14, 2024 · 4 comments
Open

Git error since using opam 2.3.0 #895

sim642 opened this issue Nov 14, 2024 · 4 comments
Labels

Comments

@sim642
Copy link

sim642 commented Nov 14, 2024

Tonight, I suppose due to #894 all jobs in one repository started failing with:

  /opt/hostedtoolcache/opam/2.3.0/x86_64/opam pin --no-action add earlybird.dev .
  [ERROR] Could not synchronize /home/runner/work/ocamlearlybird/ocamlearlybird/_opam/.opam-switch/sources/earlybird from "git+file:///home/runner/work/ocamlearlybird/ocamlearlybird#master":
          Git error: refs/remotes/opam-ref-master not found.
  [ERROR] Error getting source from git+file:///home/runner/work/ocamlearlybird/ocamlearlybird#master:
            - git+file:///home/runner/work/ocamlearlybird/ocamlearlybird#master
  
  [earlybird.dev] fetching sources failed: git+file:///home/runner/work/ocamlearlybird/ocamlearlybird#master
Error: The process '/opt/hostedtoolcache/opam/2.3.0/x86_64/opam' failed with exit code 40

In a different repository, I have no issues, so I'm not entirely sure if setup-ocaml or opam itself is at fault.

@kit-ty-kate
Copy link
Member

i was able to reproduce by forking the repository. I've added some debug variables and i ended up with:

  + /usr/bin/git "reset" "--hard" "refs/remotes/opam-ref-master" "--" (CWD=/home/runner/work/ocamlearlybird/ocamlearlybird/_opam/.opam-switch/sources/earlybird)
  - Downloading _assets/ocamlearlybird-debugging-utop-demo.gif (19 MB)
  - Error downloading object: _assets/ocamlearlybird-debugging-utop-demo.gif (2672d31): Smudge error: Error downloading _assets/ocamlearlybird-debugging-utop-demo.gif (2672d31777979316948f5b2465a681446954a6ec56a04ac3350809f14cddb493): error transferring "2672d31777979316948f5b2465a681446954a6ec56a04ac3350809f14cddb493": [0] remote missing object 2672d31777979316948f5b2465a681446954a6ec56a04ac3350809f14cddb493
  - 
  - Errors logged to '/home/runner/work/ocamlearlybird/ocamlearlybird/_opam/.opam-switch/sources/earlybird/.git/lfs/logs/20241114T133111.50658194.log'.
  - Use `git lfs logs last` to view the log.
  - error: external filter 'git-lfs filter-process' failed
  - fatal: _assets/ocamlearlybird-debugging-utop-demo.gif: smudge filter lfs failed

From that it looks like the error doesn't actually come from either ocaml-setup or opam but a corruption of git-lfs file or some kind of issue accessing that file inside of the github action. I'm not sure why that would be the case. Does anyone have an idea?

@sim642
Copy link
Author

sim642 commented Nov 14, 2024

Thanks a lot for looking into this!

I had no idea the repository even had something in LFS (I never even set it up myself because I never looked at that .gif file locally). The .gif opens on GitHub website at least, so it still seems to exist somewhere.

Perhaps this opam 2.3.0 change is somehow related:

opam now fails when git submodules fail to update instead of ignoring the error and just showing a warning

Maybe it always failed, but that failure was somehow swallowed like submodule updates before?

Either way, seems like neither ocaml-setup nor opam is really the issue here. Perhaps the GitHub Action just needs some extra permissions to access LFS for the repository or something.

@kit-ty-kate
Copy link
Member

Maybe it always failed, but that failure was somehow swallowed like submodule updates before?

the failure doesn't happen during the git submodule step and opam only calls git submodule when a /.gitmodules is present which isn't your case so this is not related.

I found a way to fix your problem but it's bringing more questions than answering them: kit-ty-kate/ocamlearlybird@2d20030. The only other thing git related that changed in 2.3 is that we're not using shallow clones anymore (it was causing issues with reproducibility) so maybe the fact that it's trying to unshallow-clone a shallow-cloned repository (the default github checkout action does a shallow clone from what i understand) is a causing issue. But then how did it work with 2.1 which has the same behaviour as 2.3

@kit-ty-kate
Copy link
Member

kit-ty-kate commented Nov 14, 2024

answering to my own question: i just tried using setup-ocaml@v2 which uses 2.1.6 and the same error appears but it delayed from the pin to the install command and there it looks like it's a non-fatal error.

So the reason it worked with 2.1 is an accident (bug).

Nonetheless i'll open a ticket in opam to at least improve the error message which is quite misleading and maybe we can find a git-lfs setting that makes it work out of the box. In the meantime the actions/checkout option should work just fine to fix your issue.

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

No branches or pull requests

3 participants