Skip to content

cli/command/manifest: allow unsetting variant and os-version in annotate - #7416

Open
GitNimay wants to merge 1 commit into
docker:masterfrom
GitNimay:4352-manifest-annotate-clear-variant
Open

GitNimay wants to merge 1 commit into
docker:masterfrom
GitNimay:4352-manifest-annotate-clear-variant

Conversation

@GitNimay

Copy link
Copy Markdown
Contributor

- What I did

docker manifest annotate only applied --variant and --os-version when the value was non-empty, so there was no way to remove a variant or OS version from a manifest entry. These flags are now applied whenever they are passed, so an empty value unsets the field. Not passing the flag keeps the existing value, as before.

Before:

$ docker manifest annotate myrepo/list myrepo/image --variant ""
# variant is unchanged (e.g. still "v8")

After:

$ docker manifest annotate myrepo/list myrepo/image --variant ""
# variant is removed

- How I did it

Record whether --variant and --os-version were set (cmd.Flags().Changed), and use that instead of a non-empty check.

- How to verify it

go test ./cli/command/manifest/ -run TestManifestAnnotate

The new TestManifestAnnotateUnsetFields test fails without this change.

- Human readable description for the release notes

Fix `docker manifest annotate` ignoring an empty `--variant` or `--os-version`, which prevented unsetting these fields.

- A picture of a cute animal (not mandatory but encouraged)

"docker manifest annotate" ignored the --variant and --os-version flags
when passed an empty value, making it impossible to remove a variant or
OS version from a manifest entry. Apply these flags whenever they are
set, so that an empty value unsets the field.

Fixes docker#4352

Signed-off-by: Nimesh Kulkarni <167794819+GitNimay@users.noreply.github.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@GitNimay GitNimay closed this Oct 19, 2026
@GitNimay GitNimay reopened this Oct 19, 2026
@GitNimay

Copy link
Copy Markdown
Contributor Author

@thaJeztah @vvoland PTAL when you have a moment.

The host (macos-14) failure looks unrelated: TestRunBuildFromGitHubSpecialCase couldn't git clone from GitHub on the runner (network). Could you re-run that job? check-changelog and validate-milestone just need an impact/ label and a milestone. Thanks!

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.

docker annotate can't remove variant

2 participants