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

blueprint: fix filesystem customization parsing #885

Merged
merged 3 commits into from
Sep 2, 2024

Conversation

ondrejbudai
Copy link
Member

In the filesystem customization, the toml tags clearly sets the MinSize field's key to minsize, this is also reflected in bootc-image-builder docs. However, the custom unmarshallers are actually wrong, they still refer to the old size name (see #825).

This PR fixes the unmarshallers, and adds more test coverage.

The toml tag and bootc-image-builder uses the new key "minsize", but the
custom unmarshaller still referred to the old "size" key. Unfortunately,
the test was also wrong.

This commit changes both the unmarshaller and the test to use new
"minsize" key, hopefully finally bringing sanity to this code.

I also changed some require.Nil calls to require.NoError to make the
test results more readable if these tests fail.
There's no functional change except for a minor adjustements of an
error. I just made sure that everything refers to minsize instead of
size. Also, I removed a comment that mentioned that the keys are called
differently in json than in toml, but that's no longer true. See e.g.
the previous commit.
@ondrejbudai ondrejbudai marked this pull request as ready for review August 30, 2024 22:03
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Thank you! This looks fine, thanks for fixing this. I was about to approve but there is the open question about backward compatiblity (I assume we do not need that as this is a bug but wanted to double check).

I would also encourage two small test tweaks that I added, happy to push them directly to this branch if people are okay with or alternatively push them as a followup :)

@@ -23,16 +23,16 @@ version = "2.4.*"

[[customizations.filesystem]]
mountpoint = "/var"
size = 2147483648
minsize = 2147483648
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume there is no risk here that there are "wrong" blueprint tomls out there that we would break with this change?

Copy link
Member

Choose a reason for hiding this comment

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

Those cases are handled by the custom unmarshaller in osbuild-composer before being sent through to the code here in images.

pkg/blueprint/blueprint_test.go Show resolved Hide resolved
pkg/blueprint/filesystem_customizations.go Show resolved Hide resolved
Copy link
Member

@achilleas-k achilleas-k left a comment

Choose a reason for hiding this comment

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

LGTM. I think we should merge this, rebase #886 to get it moving along, and add test improvements separately. @mvo5 wdyt?
(Feel free to just resolve your comments if you agree)

@achilleas-k achilleas-k added this pull request to the merge queue Sep 2, 2024
Merged via the queue into osbuild:main with commit e7ae92b Sep 2, 2024
18 checks passed
@mvo5 mvo5 mentioned this pull request Sep 2, 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.

3 participants