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

dockerfile: fix oci source to load image config data #3034

Merged
merged 2 commits into from
Aug 24, 2022

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Aug 16, 2022

Fixes #3033

Config from the OCI source was previously not correctly parsed and returned from the contextByName function, preventing fields like the WorkingDir from correctly being propogated through.

This fix ensures that the config is correctly json-parseable, and that the data is properly returned.

CC @deitch

@jedevc jedevc requested a review from tonistiigi August 16, 2022 10:57
Copy link
Contributor

@deitch deitch left a comment

Choose a reason for hiding this comment

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

This makes sense, and nice catch on the gap between oci registry and oci layout sources for dockerfile frontend.

@tonistiigi
Copy link
Member

Could we update this test to cover this. It is testing loading env but not exporting it https://github.com/moby/buildkit/pull/2827/files#diff-93731187c2a292b7e92b852225675f88b41b7634dafd66cfeab50697bd806ddbR5488-R5492

@jedevc
Copy link
Member Author

jedevc commented Aug 18, 2022

Have modified the test to check that workdir is correctly checked - I think that should check the exporting case correctly. I'd rather not change the exporter in the second case from the local to a oci/image, since then checking files in that is slightly more fiddly, since we have to inspect layers (maybe we should have some helpers around testutil for this).

@tonistiigi
Copy link
Member

I think that should check the exporting case correctly. I

This test still only checks the import phase(like the env case did before) and not image export. Add a separate test that directly exports the config that is read from the oci-layout. That should then fail before this fix.

jedevc added 2 commits August 24, 2022 15:30
Config from the OCI source was previously not correctly parsed and
returned from the contextByName function, preventing fields like the
WorkingDir from correctly being propogated through.

This fix ensures that the config is correctly json-parseable, and that
the data is properly returned.

Signed-off-by: Justin Chadwell <me@jedevc.com>
To test the behavior in the previous commit, we check that workdir
inheritance works by setting it in the base image. Additionally, we add
a new test to check the exported results of images that use these oci
contexts.

Signed-off-by: Justin Chadwell <me@jedevc.com>
@jedevc jedevc force-pushed the oci-source-workdir branch from 4c24598 to c16dcec Compare August 24, 2022 14:34
@jedevc
Copy link
Member Author

jedevc commented Aug 24, 2022

Added a new test and confirmed it fails before the fix and fails after 👍

@tonistiigi tonistiigi merged commit 25dd002 into moby:master Aug 24, 2022
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.

OCI Source ignores WORKDIR/WorkingDir
4 participants