Repository navigation
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
vvoland
previously approved these changes
Nov 24, 2023
| Arch: arch(), | ||
| Context: contextName, | ||
| Version: version.Version, | ||
| APIVersion: api.DefaultVersion, |
Collaborator
There was a problem hiding this comment.
If no server information is fetched:
docker info --format='{{ json .ClientInfo }}' | jq .ApiVersion
"1.44"If server information is fetched:
docker info --format='{{ json .}}' | jq .ClientInfo.ApiVersion
"1.43"An alternative could be to leave the ApiVersion field empty if no negotiation took place.
Hmm not sure about this one.
On one side it's weird for the version to be different depending on the format, on the other side side being empty is also not great.
I think leaving it empty if no negotiation took place would be slightly more useful:
- It's already that way so there's no existing expectation that it's always non-empty
- Empty value is better than misleading value as it's easier to notice
- The CLI APIVersion that's not impacted by the server negotiation is already there in
DefaultAPIVersionanddocker version --format='{{ json .Client }}' | jq .ApiVersion
The current logic was ignoring (e.g.) `--format=json` formats, and was only setting the negotiated API version if no format was specified. While we do want to avoid calling the API if possible, we do already check if the given template requires a server connection, so let's move updating the API version to that block. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Set the APIVersion and DefaultAPIVersion fields to the default version,
as that's the version the client assumes without making a API connection
to do version negotiation.
One change worth mentioning is that this means that the API version will
differ, depending on the format:
If no server information is fetched:
docker info --format='{{ json .ClientInfo }}' | jq .ApiVersion
"1.44"
If server information is fetched:
docker info --format='{{ json .}}' | jq .ClientInfo.ApiVersion
"1.43"
An alternative could be to leave the ApiVersion field empty if no
negotiation took place.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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.
cli/command/system/runInfo: set negotiated API version when available
The current logic was ignoring (e.g.)
--format=jsonformats, and wasonly setting the negotiated API version if no format was specified.
While we do want to avoid calling the API if possible, we do already
check if the given template requires a server connection, so let's
move updating the API version to that block.
cli/command/system/newClientVersion: initialize with default API version
Set the APIVersion and DefaultAPIVersion fields to the default version,
as that's the version the client assumes without making a API connection
to do version negotiation.
differ, depending on the format:
If no server information is fetched:
If server information is fetched:
An alternative could be to leave the ApiVersion field empty if no
negotiation took place.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)