[26.1 backport] context list: temporarily add ContextType to JSON output by thaJeztah · Pull Request #5095 · docker/cli

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 54291dd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The CLI does not currently expose options to add custom metadata to
contexts, but contexts support them.

- update test-utilities to allow setting custom metadata
- update the inspect test to verify that custom metadata is included
  when inspecting a context.
- update the import/export tests to verify that custom metadata
  is preserved.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2e9eff2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 40a1da8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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 <github@gone.nl>
(cherry picked from commit fed9fa0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

sam-thibault

@thaJeztah thaJeztah marked this pull request as ready for review

May 31, 2024 20:00

@thaJeztah thaJeztah deleted the 26.1_backport_context_type_stub branch

May 31, 2024 20:01

renovate bot added a commit to earthly/dind that referenced this pull request

Jun 10, 2024

renovate bot added a commit to earthly/dind that referenced this pull request

Jun 10, 2024