Skip to content
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

Add support for imagefs and fix multi-stage cache probing #25

Merged
merged 13 commits into from
Aug 29, 2024

Conversation

mafredri
Copy link
Member

This PR adds support for imagefs which currently only supports pre-caching requested files. This means that Dockerfile instructions are resolved ahead of time to figure out which files to cache.

This allows tar archives to be walked once and since files are hashed as-we-go, the implementation is also memory efficient.

Once envbuilder updates to this fork, tha issue coder/envbuilder#230 will be resolved.

pkg/executor/build.go Outdated Show resolved Hide resolved
pkg/imagefs/imagefs.go Outdated Show resolved Hide resolved
pkg/imagefs/imagefs.go Outdated Show resolved Hide resolved
pkg/imagefs/imagefs.go Show resolved Hide resolved
pkg/imagefs/imagefs.go Outdated Show resolved Hide resolved
pkg/executor/build.go Show resolved Hide resolved
pkg/imagefs/imagefs.go Show resolved Hide resolved
pkg/imagefs/imagefs.go Outdated Show resolved Hide resolved
pkg/imagefs/imagefs.go Outdated Show resolved Hide resolved
pkg/imagefs/imagefs.go Outdated Show resolved Hide resolved
pkg/executor/build.go Outdated Show resolved Hide resolved
pkg/executor/build_test.go Show resolved Hide resolved
args: args{
dockerfile: `
FROM scratch as target
COPY --from=alpine /etc/alpine-release /etc/alpine-release
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: have you tried implementing more tests?

  1. FROM three different image.
  2. Copy symlink.
  3. Overwriting a file FROM first image with the file FROM the second image.
  4. Image with cycle symlink inside.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I enabled the disabled TestDoCacheProbe/MultiStage test and added a symlink copy. This tests the basics of cache probe for multi-stage. We'll do more integration testing in envbuilder.

Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Nice work!

pkg/executor/build.go Outdated Show resolved Hide resolved
pkg/executor/build.go Outdated Show resolved Hide resolved
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go!

@mafredri mafredri changed the title Add support for imagefs and fix multi stage cache probing Add support for imagefs and fix multi-stage cache probing Aug 29, 2024
@mafredri mafredri merged commit 8cd5f9f into main Aug 29, 2024
9 checks passed
@mafredri mafredri deleted the mafredri/multistage-cache-probing-vfs branch August 29, 2024 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants