Normalize feature permissions in an intetermediate stage before copying them to the final container#233
Merged
Chuxel merged 2 commits intodevcontainers:mainfrom Oct 28, 2022
Conversation
…ng them to the final container
Contributor
Author
|
@microsoft-github-policy-service agree [company="Weights and Biases"] |
Contributor
Author
|
@microsoft-github-policy-service agree company="Weights and Biases" |
edgonmsft
previously approved these changes
Oct 25, 2022
Contributor
edgonmsft
left a comment
There was a problem hiding this comment.
Hey! Sorry for the delay but it does look ok to me!
Contributor
Author
Thank you! Would you mind merging it for me? |
Member
|
@chrmarti wanted to take a quick look now that he is back. This look good Christof? |
chrmarti
requested changes
Oct 28, 2022
Contributor
chrmarti
left a comment
There was a problem hiding this comment.
Thanks @davidwallacejackson! This looks very promising. I have left a comment for discussion.
edgonmsft
approved these changes
Oct 28, 2022
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #153.
Since the underlying problem was that the permissions for features sources became corrupted and invalidated the cache, I added a new build stage that serves only to
COPYthe features sources andchmodthem to0600. This way, by the time the actual work of installing the features is performed the permissions will have been normalized, allowing subsequent runs to use the install layers as cache.I tested this manually by
docker buildx prune -af)docker pulling the built image back onto my machine from Docker Hub--cache-fromon the image from Docker Hub, to validate that the cache is not used by the release version. I canceled this build before it could finish, once it was clear the cache was not being used.--cache-fromagain, but using this version of the CLI (the cache was used successfully)This might be worth adding to tests, but it'd be a bit awkward -- you'd have to basically recreate the process above and then run regexes on the output to see if you got a cache hit. I can take a crack at that, if that's a blocker for merging.
Side note: in case anybody's curious why I used an additional stage instead of simply adding a
RUN chmod -R 0600 /tmp/build-featuresafter theCOPY, it's because you don't get the cache without the extra stage -- BuildKit is apparently smart enough to identify when two contexts are equal, but doesn't seem to have the same capability at the individual layer level. This demo shows this in action.