-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix caching when mounting a cached stage with COPY/ADD
A comment states that avoidLookingCache is set when a previous stage that executed as part of the build is referenced by --mount, to avoid reusing content from an older build of the stage: // Only attempt to find cache if its needed, this part // so that if a step is using RUN --mount and mounts // previous stages then it uses the freshly built stage // of re-using the older stage from the store. However, stages consisting of COPY/ADD seem to be flagged with didExecute even if they were fetched from cache instead. I believe this is an oversight, and these stages should not prevent subsequent caching. Also, avoidLookingCache would prevent a cache push, but I think it should only prevent cache lookups, since populating the cache is still useful in these caess. It's very possible I'm misunderstanding something, but I believe the RUN step in test case I've added wrongly skips cache, and I'd appreciate some pointers in the right direction if what I've proposed here isn't the right solution. Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
- Loading branch information
1 parent
39ea15c
commit b413360
Showing
4 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM scratch AS stage1 | ||
COPY / / | ||
|
||
FROM alpine | ||
RUN --mount=type=bind,from=stage1,target=/mnt echo hi > test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hi, I'm a test file. Enjoy the test. |