Fix using docker specific ignore with read-only build context#72
Conversation
|
@saehejkang Hi! If you have time, could you give a review on this PR? |
| "google.golang.org/grpc" | ||
| ) | ||
|
|
||
| const DockerfileStaging = fileutils.DockerfileStaging |
There was a problem hiding this comment.
Even though this const can be shared with other files in this package, this might live better in the file that uses it (diffcopy.go)?
EDIT: I can see why it lives here if you wanted files in other packages to import fssync for readability
EDIT 2: On second thought, what if in another issue/PR we create a dedicated file for all the constants to live?
There was a problem hiding this comment.
Yeah. I also thought it'd be better if we have some dedicated file for all the constants :)
We can work on it later when we hit more use cases.
Tried my best to gain as much context as possible, before I went through your changes. Other than the comments above, nothing looks out of the ordinary to me. |
I really appreciate for your time! Thanks! |
Co-authored-by: Saehej Kang <20051028+saehejkang@users.noreply.github.com>
Co-authored-by: Saehej Kang <20051028+saehejkang@users.noreply.github.com>
lol there was no need to add me as co-author on the most recent commits 😅 |
This PR resolves #1343. This PR depends on apple/container-builder-shim#72. Do not create staging directory under build context, but pass dockerignore file bytes to the container-builder-shim. ## Type of Change - [x] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation update ## Motivation and Context [Why is this change needed?] ## Testing - [x] Tested locally - [ ] Added/updated tests - [ ] Added/updated docs
This PR resolves the issue when using docker specific ignore file with read-only build context (apple/container#1343).
Once the
dockerignoreargument is provided inPerformBuildgRPC, it performs following two operations.First, after unpacking transferred build context archive into
cachedirectory, it creates aDockerfileStaging(i.e.,.com.apple.container) directory there, and copiesDockerfileandDockerfile.dockerignore. The path toDockerfileStagingis passed to the buildkit daemon so that it can correctly figure out which dockerignore file to read.Second, it handles data requests for
DockerfileandDockerfile.dockerignore(i.e.,diffcopy.go:sender::sendFile), so that the requests before the actual files are written can be correctly served---i.e., refer #71 for more context about this race issue.