cli/command/system: define struct for formatting version#6648
Merged
thaJeztah merged 1 commit intodocker:masterfrom Nov 12, 2025
Merged
cli/command/system: define struct for formatting version#6648thaJeztah merged 1 commit intodocker:masterfrom
thaJeztah merged 1 commit intodocker:masterfrom
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Nov 12, 2025
The client.ServerVersion method in the moby/client module defines an output struct that's separate from the API response. These output structs are not designed to be marshaled as JSON, but the CLI depended on them defining `json` labels, which it used to format the output as JSON (`docker version --format=json`); as a result, the JSON output changed in docker v29, as it would now use the naming based on the Go struct's fields (`APIVersion` instead of `ApiVersion`). In future, we should consider having a `--raw` (or similar) option for the CLI to print API responses as-is, instead of using client structs or CLI structs for this (this would also make sure the JSON output does not inherit client-side formatting of fields). For now, let's create a struct for formatting the output, similar to what we do for the client-side information. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
736df9d to
bff56f0
Compare
vvoland
reviewed
Nov 12, 2025
Comment on lines
+149
to
+153
| out.GitCommit = component.Details["GitCommit"] | ||
| out.GoVersion = component.Details["GoVersion"] | ||
| out.KernelVersion = component.Details["KernelVersion"] | ||
| out.Experimental = func() bool { b, _ := strconv.ParseBool(component.Details["Experimental"]); return b }() | ||
| out.BuildTime = reformatDate(component.Details["BuildTime"]) |
Collaborator
There was a problem hiding this comment.
These were empty in 29.0.0. Is it intentional to restore them?
Member
Author
There was a problem hiding this comment.
Yeah, I was on the fence on these; decided to keep the status quo (pre v29) for now, in case there's people depending on them after all but we should consider removing them.
vvoland
approved these changes
Nov 12, 2025
austinvazquez
approved these changes
Nov 12, 2025
Member
Author
|
OK, let's bring this one in 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docker versionJSON ouput case changed in version 29.0.0, inconsistent and breaks utilities #6649The client.ServerVersion method in the moby/client module defines an output struct that's separate from the API response. These output structs are not designed to be marshaled as JSON, but the CLI depended on them defining
jsonlabels, which it used to format the output as JSON (docker version --format=json); as a result, the JSON output changed in docker v29, as it would now use the naming based on the Go struct's fields (APIVersioninstead ofApiVersion).In future, we should consider having a
--raw(or similar) option for the CLI to print API responses as-is, instead of using client structs or CLI structs for this (this would also make sure the JSON output does not inherit client-side formatting of fields).For now, let's create a struct for formatting the output, similar to what we do for the client-side information.
- What I did
- How I did it
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)