-
Notifications
You must be signed in to change notification settings - Fork 2k
context list: temporarily add ContextType to JSON output #5094
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5094 +/- ##
=======================================
Coverage 61.37% 61.37%
=======================================
Files 298 298
Lines 20707 20718 +11
=======================================
+ Hits 12708 12716 +8
- Misses 7099 7102 +3
Partials 900 900 |
d2dea15
to
9e337b5
Compare
Interesting; for some reason static check does NOT complain about using deprecated field 🤔 wondering if we have some config incorrect in golangci-lint; I would expect it to barf;
|
9e337b5
to
c36afe1
Compare
The binary with this patch will only be used with DD for the upcoming release (and maybe one after that?), is that correct? |
Yes(ish); I wanted to avoid having to build some forked version of the CLI, so tried to create a patch with as minimal-as-possible impact, so that we could included it in a v26.1.4 patch release. |
if this does go out to "everyone" (and not only dd users), we need to document this in a visible way and be ready in case anything else breaks (i guess, just in case any other project depends on the shape of that json in even worse ways?) |
d697869
to
7789668
Compare
I added 3 commits to improve test-coverage; last commit is the change related to ContextType PTAL |
Maybe it's cleaner to move those 3 commits to a separate PR, so that this PR is only showing the changes related to ContextType; let me open a separate PR for the first 3 commits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I'll rebase this one to get rid of the other commits |
Docker Desktop currently ships with the "cloud integration" wrapper, which outputs an additional ContextType field in the JSON output. While this field is non-standard, it made its way into Visual Studio's Docker integration, which uses this to exclude "aci" and "eci" context types that are not supported by Visual Studio. This patch; - conditionally adds a ContextType field to the JSON output - but ONLY when using the default "{{json .}}" or "json" formats (which are the formats used by Visual Studio) - if the context is a "aci" or "eci" context, that type is preserved, otherwise the default "moby" type is used. Signed-off-by: Sebastiaan van Stijn <[email protected]>
7789668
to
fed9fa0
Compare
Rebased and moved out of draft |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, approving as to not block this.
// We only need the ContextType field when formatting as JSON, | ||
// which is the format-string used by Visual Studio to detect the | ||
// context-type. | ||
return "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One curiosity: could it also be possible to check if the current context being used is from DD? Do we have ways of determining that from here, aside from the context name itself (which i totally wouldn't rely on)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the custom metadata could allow for things like that; we need to better define things here; it's all quite opaque (i.e. custom metadata is supported, but nothing defines it well); some digging may be needed there, because ISTR there's some complex code present to try to match "custom" metadata to be mapped into a specific type / interface.
And that's where my head always explodes, and we need to remove a ton of unneeded complexity.
(in the end, a context is .. well.. not so much different from just key/value pairs ... but it also uses a map[string]any
so it's not just "key=value" strings - which is both "great" and "not so great.."😞
Docker Desktop currently ships with the "cloud integration" wrapper, which outputs an additional ContextType field in the JSON output.
While this field is non-standard, it made its way into Visual Studio's Docker integration, which uses this to exclude "aci" and "eci" context types that are not supported by Visual Studio.
This patch;
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)