Skip to content

manifest: accept human-readable image sizes - #2571

Open
tomatotomata wants to merge 3 commits into
osbuild:mainfrom
tomatotomata:codex/image-size-2570
Open

manifest: accept human-readable image sizes#2571
tomatotomata wants to merge 3 commits into
osbuild:mainfrom
tomatotomata:codex/image-size-2570

Conversation

@tomatotomata

Copy link
Copy Markdown

Fixes #2570

Summary

  • let manifest --image-size use the existing datasizes.Size parser
  • accept both raw byte counts and values with data-size units
  • cover text marshaling and command flag parsing for both input forms

Testing

  • go test ./pkg/datasizes
  • GOOS=linux CGO_ENABLED=0 go test ./cmd/image-builder (cannot complete on this Windows host because github.com/proglottis/gpgme has no non-cgo build; the command package requires the project's Linux build dependencies)

@lucasgarfield

Copy link
Copy Markdown
Contributor

Huh, a robot?

image

@supakeen supakeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code works, thank you. One request for change in the review comments just for consistency.

It might be a bit harder but I'd like a commit message as well instead of just a subject line. It can include the usage (since users need to quote values-with-spaces).


Not 100% necessary in my opinion but maybe a manifest smoke test in main_test.go might make sense to ensure things don't blow up when passing this into manifest generation?

Comment thread pkg/datasizes/size.go Outdated
func (si *Size) UnmarshalText(data []byte) error {
value, err := Parse(string(data))
if err != nil {
return err

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The other unmarshallers wrap this is a new error (see for example line 39), let's do the same here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed this in 2023bcb. UnmarshalText now wraps Parse errors with error decoding size: ..., matching the JSON and TOML paths, and TestSizeUnmarshalTextUnhappy locks in the context. go test ./pkg/datasizes passes. I left the unrelated worktree changes untouched. Let me know what you think.

@supakeen
supakeen marked this pull request as ready for review July 31, 2026 06:12
@supakeen
supakeen requested a review from a team as a code owner July 31, 2026 06:12
@supakeen

Copy link
Copy Markdown
Member

Huh, a robot?
image

Robots are taking over.

@tomatotomata

Copy link
Copy Markdown
Author

I took the consistency request as adding a fuller command description, not only the one-line subject. Commit 8dda9ec adds Long and an explicit quoted image-size 1 GiB example, with a small help-text regression test. The existing parser and flag tests stay unchanged; let me know what you think.

@supakeen

Copy link
Copy Markdown
Member

I took the consistency request as adding a fuller command description, not only the one-line subject. Commit 8dda9ec adds Long and an explicit quoted image-size 1 GiB example, with a small help-text regression test. The existing parser and flag tests stay unchanged; let me know what you think.

You didn't address the error wrapping comment: #2571 (comment) which is probably more important :)

@supakeen
supakeen force-pushed the codex/image-size-2570 branch from 2023bcb to a456273 Compare July 31, 2026 13:02
supakeen
supakeen previously approved these changes Jul 31, 2026

@supakeen supakeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you, looks good now. I'd prefer if you squash the fix commit(s) into the first commit but I won't block on that.

lzap
lzap previously approved these changes Aug 6, 2026

@lzap lzap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am tired counting figures, love it.

@supakeen

supakeen commented Aug 6, 2026

Copy link
Copy Markdown
Member

Needs a rebase @tomatotomata.

@tomatotomata
tomatotomata dismissed stale reviews from lzap and supakeen via 5db48e1 August 6, 2026 08:49
@tomatotomata
tomatotomata force-pushed the codex/image-size-2570 branch from a456273 to 5db48e1 Compare August 6, 2026 08:49
@tomatotomata

Copy link
Copy Markdown
Author

I rebased the branch onto the current main and pushed 5db48e118. The focused parser and command tests still pass locally, and git diff --check is clean. The full command-package test remains Linux-only from this Windows host because the local checkout cannot build gpgme and the Unix statfs path. The new CI run is in progress. Let me know what you think once it finishes.

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.

Accept a datasizes.Size for --image-size

4 participants