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 parse configuration's use of abstract filesystems #395

Merged
merged 3 commits into from
Apr 19, 2023

Conversation

luhring
Copy link
Member

@luhring luhring commented Apr 19, 2023

This PR fixes two issues:

  1. A test for the bump logic was using assert.NoError instead of require.NoError, so it panicked when the test proceeded to use a nil object after an error case.

  2. ParseConfiguration wasn't correctly handling abstract filesystems. In general, when using an fs.FS, the code should be able to trust that the config file path is meant for that filesystem, but it was using filepath.Base in anticipation of receiving an absolute filepath for the actual OS filesystem. This PR detects if the caller is setting their own fs.FS and uses the given path "as-is" if so. In the future, we should adjust ParseConfiguration to always use a provided fs.FS and thus always trust that the given config path is correct as-is.

These issues were caught via tests in wolfictl.

@luhring luhring requested a review from a team as a code owner April 19, 2023 13:34
@luhring luhring requested review from rawlingsj and removed request for a team April 19, 2023 13:34
jdolitsky
jdolitsky previously approved these changes Apr 19, 2023
luhring added 3 commits April 19, 2023 11:48
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
@luhring
Copy link
Member Author

luhring commented Apr 19, 2023

We believe these E2E test failures to be unrelated to the changes in this PR, caused instead by this issue, and as proven by this dummy PR.

@kaniini kaniini disabled auto-merge April 19, 2023 16:43
@kaniini kaniini merged commit 48e21af into chainguard-dev:main Apr 19, 2023
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.

4 participants