-
Notifications
You must be signed in to change notification settings - Fork 485
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
[v0.14] invalid cached file sent to context with buildx #2552
Comments
Found a similar old issue from buildkit side, which was related to Dockerfile handling: moby/buildkit#1368 Filenames and timestamps suggest a similar underlying issue with this regression. |
I don't know why you've marked it as regression. This is expected behavior moby/buildkit#4817 if you reset the timestamps of files. Same as rsync and git. |
The reasoning is that older versions used to work, however if this is expected we must have relied on a bug. I would be interested to know how monorepos are expected to setup docker image builds, as you can very easily end up with identical timestamps for different folders if those files are created or modified by same checkouts. Providing the entire monorepo as build context seems wasteful and slow, so my guess would be to utilize named build contexts per subproject. But this feels like a hack since you anyways need to provide the default build context in addition to that, which will basically be an empty folder. |
Sorry, this is indeed a regression and fixed in #2558 While the metadata based transfer is correct, this should not affect your example case as you are transferring from a different directory. We have validation that the incremental transfers are used only when the same source directory (basename+node identifier) is reused. That part broke in v0.14 . You can still have a similar case if you make a non-metadata change to a file and then reset its timestamp, but you shouldn't be able to get this when building two different directories that both contain a file with the same timestamp. |
Contributing guidelines
I've found a bug and checked that ...
Description
When using files in build context with same size, filename and timestamp information, new buildx versions use cli side cache incorrectly. I have verified v0.13.1 is the last version to work correctly, v0.14.0 and v0.15.1 have the issue present.
Issue can be reproduced with a simple shell script in Configuration section.
Expected behaviour
Both app1 and app2 in the example provided should get correct input files as they are different.
Actual behaviour
Build of app1 caches
code
file and app2 incorrectly uses it.Buildx version
github.com/docker/buildx v0.15.1 1c1dbb2
Docker info
Builders list
Configuration
Build logs
Additional info
Originally the issue was discovered in git repositories that happened to add files with same name and size to multiple folders, after which timestamps were aligned by others cloning that repository.
There are at least three workarounds known to me at the moment:
The text was updated successfully, but these errors were encountered: