-
Notifications
You must be signed in to change notification settings - Fork 386
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
Unable to use inline cache: invalid layer index #1635
Comments
Hi @andyli, I don't see any obvious issue at first glance. This could be a buildkit bug. Is this something that happened that one time only, or does it happen consistently every time? |
It happens everytime. |
EDIT: I resolved this problem on my own, I don't think it was related to this bug. When I used a different Docker Hub org like my personal account (instead of company org), the problem vanished. My guess is that the company org has a setting turned on that my personal org doesn't. I'll keep this info here just in case though! Debugging infoHi, I'm also seeing something that could be related to this bug! It seems a little more specific, though.I'm pulling several images using
Then I get the failure with
Some debugging observations: I only get this error on GitHub Actions runners (running Ubuntu 20.04). When I run the same earthly invocation locally (also on Ubuntu 20.04), everything works great. Both my local machine and the GHA runners are on the latest version of Earthly, v0.6.6. I'm invoking Hope this helps, I'm very interested in figuring out what's going on here! |
Hi @andyli, are you logged into ghcr.io using a personal access token? Does that token have read and write packages permissions? If I recall correctly, this behavior was changed recently and you may need to update your credentials. Maybe that will help? |
I used |
https://github.com/sesgoe/earthly-invalid-cache-repro I've got this one up and it seems to reliably reproduce this. This is a maddening little thing to find, whatever it ends up being. |
I was able to reproduce this on my computer. Thanks for the repro code! I'm attempting to fix this now. Some initial investigation seems to point to the writing side. There seems to be a bug in the inline cache config writer, which causes the reading side to spit out that error. |
The issue seems to be related to this piece of the image writer code: https://github.com/moby/buildkit/blob/master/exporter/containerimage/writer.go#L479-L481. It seems that if the image writer finds an empty layer, it removes it from the descriptor list, however, the indexes referenced from the inline cache manifest aren't updated after that. This leads to indexes that end up being out of bounds sometimes (and possibly other cache inefficiencies that are less obvious). An easy fix could be to simply remove that little optimization for now. |
It seems that the only affected builds were the ones that contained RUN (maybe others too?) commands that have no effect on the root file system. e.g. |
As my fellow "you also got hit by this bug" comrades, I wanted to share some tips to get you unblocked until this fix gets pulled into I saw this comment this morning on Vlad's PR into buildkit: moby/buildkit#2651 (comment) Which references this So I examined my
@andyli your initial Might be the source of the issue for now. Just wanted to let you both know in case something like this unblocks you. Have a great rest of your week! |
The fix for this has now been released in |
My project just adopted earthly. Its repo is over https://github.com/hkssprangers/hkssprangers
The GitHub Actions build failed to use inline cache, complaining about
invalid layer index
.The Earthfile at the the of writing: https://github.com/hkssprangers/hkssprangers/blob/61cdab2ac66969ad42dfb0ed897b4f61ff5d9134/Earthfile
The cache image in use (was tagged as
master
):ghcr.io/hkssprangers/hkssprangers_devcontainer:4ec6d5284fb13000a27bc6da9de8f9332a1afa30
Build log:
The text was updated successfully, but these errors were encountered: