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

Fix mounting file into image source #203

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

cpuguy83
Copy link
Member

@cpuguy83 cpuguy83 commented Apr 9, 2024

The old behavior was odd in this case where it could mount the file into a subdirectory of the path we requested (not desirable) and it was named after the parent source.
E.g. if you have an image source "foo" and you specify a file-based source at mount point '/some_file', it would mount this file as "/some_file/foo".

Related to the comment in this gist: https://gist.github.com/cpuguy83/c570f3ea97af215af63264061cac94af#file-spec-yaml-L114

@cpuguy83 cpuguy83 requested a review from adamperlin April 9, 2024 00:37
@cpuguy83 cpuguy83 requested a review from a team as a code owner April 9, 2024 00:38
The old behavior was odd in this case where it could mount the file into
a subdirectory of the path we requested (not desirable) and it was named
after the parent source.
E.g. if you have an image source "foo" and you specify a file-based
source at mount point '/some_file', it would mount this file as
"/some_file/foo".

Signed-off-by: Brian Goff <[email protected]>
@@ -195,7 +195,7 @@ func generateSourceFromImage(name string, st llb.State, cmd *Command, sOpts Sour
baseRunOpts := []llb.RunOption{CacheDirsToRunOpt(cmd.CacheDirs, "", "")}

for _, src := range cmd.Mounts {
srcSt, err := src.Spec.AsMount(name, sOpts, opts...)
Copy link
Contributor

@adamperlin adamperlin Apr 10, 2024

Choose a reason for hiding this comment

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

I think this may have been a mistake from the refactor

Copy link
Member Author

Choose a reason for hiding this comment

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

🤷 It happens, now we have a test case for it 😆

Copy link
Contributor

@adamperlin adamperlin left a comment

Choose a reason for hiding this comment

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

This looks good to me. Fairly straightforward fix

@cpuguy83 cpuguy83 merged commit c7d08e0 into Azure:main Apr 10, 2024
9 checks passed
@cpuguy83 cpuguy83 deleted the fix_file_source_mount branch April 11, 2024 14:56
@cpuguy83 cpuguy83 added this to the v0.3.0 milestone Apr 12, 2024
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.

2 participants