Skip to content

Commit 4700423

Browse files
committed
Merge branch 'main' into bmw/zod
2 parents c3646d6 + 037c03f commit 4700423

File tree

11 files changed

+535
-497
lines changed

11 files changed

+535
-497
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
## Extensibility Packages for Docker extension for VS Code
2-
This repository contains several extensibility packages for the Docker extension for VS Code.
1+
## Extensibility Packages for Container Tools extension for VS Code
2+
This repository contains several extensibility packages for the Container Tools extension for VS Code.
33

44
### [vscode-container-client](https://github.com/microsoft/vscode-docker-extensibility/tree/main/packages/vscode-container-client)
5-
Library support for multiple Docker container runtimes.
5+
Library support for multiple container runtimes.
66

77
### [vscode-docker-registries](https://github.com/microsoft/vscode-docker-extensibility/tree/main/packages/vscode-docker-registries)
88
Unified container registry provider model.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vscode-container-client/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 0.2.2 - 3 June 2025
2+
### Added
3+
* Added support for the `--platform` argument in `runContainer()`. [#258](https://github.com/microsoft/vscode-docker-extensibility/issues/258)
4+
5+
## 0.2.1 - 11 March 2025
6+
### Added
7+
* Added the container stats command. This would previously always throw a `CommandNotSupportedError`. However, the typing has changed to a `VoidCommandResponse`. [#254](https://github.com/microsoft/vscode-docker-extensibility/issues/254)
8+
19
## 0.2.0 - 10 February 2025
210
### Added
311
* Added a client for Podman. [#221](https://github.com/microsoft/vscode-docker-extensibility/issues/221)

packages/vscode-container-client/NOTICE.html

Lines changed: 475 additions & 474 deletions
Large diffs are not rendered by default.

packages/vscode-container-client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# vscode-container-client
22

33
## Overview
4-
This package adds support for various Docker container runtimes, abstracting away the details of the runtime and the way it is called, to provide a common interface for any Docker runtime (e.g. Docker in WSL, Docker Engine, Docker Desktop, etc.).
4+
This package adds support for various container runtimes, abstracting away the details of the runtime and the way it is called, to provide a common interface for any container runtime (e.g. Docker in WSL, Docker Engine, Docker Desktop, Podman, etc.).
55

66
## Usage
77
Each of the runtime clients provide a command line to execute and a function to parse the output, for each relevant operation. These items are combined into a `CommandResponse` object. In addition, many helpful utility classes are provided, for building command lines, running the commands, and a handful of other scenarios.

packages/vscode-container-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@microsoft/vscode-container-client",
33
"author": "Microsoft Corporation",
4-
"version": "0.2.0",
4+
"version": "0.2.2",
55
"description": "Extensibility model for implementing container runtime providers (shared by VS and VS Code)",
66
"license": "See LICENSE in the project root for license information.",
77
"repository": {

packages/vscode-container-client/src/clients/DockerClientBase/DockerClientBase.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
677677
withNamedArg('--env-file', options.environmentFiles),
678678
withNamedArg('--entrypoint', options.entrypoint),
679679
withDockerExposePortsArg(options.exposePorts),
680+
withDockerPlatformArg(options.platform),
680681
withVerbatimArg(options.customOptions),
681682
withArg(options.imageRef),
682683
typeof options.command === 'string' ? withVerbatimArg(options.command) : withArg(...(toArray(options.command || []))),
@@ -963,16 +964,11 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
963964
)();
964965
}
965966

966-
protected async parseStatsContainersCommandArgs(
967-
options: ContainersStatsCommandOptions,
968-
output: string,
969-
strict: boolean,
970-
): Promise<string> {
971-
return output;
972-
}
973-
974-
async statsContainers(options: ContainersStatsCommandOptions): Promise<PromiseCommandResponse<string>> {
975-
throw new CommandNotSupportedError('statsContainers is not supported for this runtime');
967+
async statsContainers(options: ContainersStatsCommandOptions): Promise<VoidCommandResponse> {
968+
return {
969+
command: this.commandName,
970+
args: this.getStatsContainersCommandArgs(options),
971+
};
976972
}
977973

978974
//#endregion

packages/vscode-container-client/src/contracts/ContainerClient.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,10 @@ export type RunContainerCommandOptions = CommonCommandOptions & {
722722
* Optional expose ports for the container
723723
*/
724724
exposePorts?: Array<number>;
725+
/**
726+
* Target platform for the container
727+
*/
728+
platform?: ContainerPlatform;
725729
/**
726730
* Additional custom options to pass
727731
*/
@@ -1172,7 +1176,7 @@ type ContainersStatsCommand = {
11721176
* Show running container stats
11731177
* @param options Command options
11741178
*/
1175-
statsContainers(options: ContainersStatsCommandOptions): Promise<PromiseCommandResponse<string>>;
1179+
statsContainers(options: ContainersStatsCommandOptions): Promise<VoidCommandResponse>;
11761180
};
11771181

11781182
// #endregion

packages/vscode-container-client/src/test/DockerClient.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,33 @@ describe('DockerClient (unit)', () => {
197197
expect(pwshQuoted).to.deep.equal(['container', 'run', 'someimage', 'sh', '-c', 'echo` hello` world']);
198198
expect(bashQuoted).to.deep.equal(['container', 'run', 'someimage', 'sh', '-c', 'echo\\ hello\\ world']);
199199
});
200+
201+
it('Should include platform flag when platform is specified', async () => {
202+
const options: RunContainerCommandOptions = {
203+
imageRef: 'someimage',
204+
platform: {
205+
os: 'linux',
206+
architecture: 'arm64'
207+
},
208+
};
209+
210+
const commandResponse = await client.runContainer(options);
211+
const args = commandResponse.args;
212+
213+
// Find the position of --platform flag
214+
const platformFlagIndex = args.findIndex(arg =>
215+
typeof arg === 'string' ? arg === '--platform' : arg.value === '--platform'
216+
);
217+
218+
// Verify that --platform flag is present
219+
expect(platformFlagIndex).to.be.greaterThan(-1);
220+
221+
// Verify that the value after --platform matches our expected platform
222+
const platformValue = args[platformFlagIndex + 1];
223+
const platformValueStr = typeof platformValue === 'string'
224+
? platformValue
225+
: platformValue.value;
226+
227+
expect(platformValueStr).to.equal('linux/arm64');
228+
});
200229
});

packages/vscode-docker-registries/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Docker for Visual Studio Code: Extensibility Model
1+
# Container Tools for Visual Studio Code: Extensibility Model
22

33
## Overview
4-
This package provides the necessary interfaces to implement a registry provider for the [Docker extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) for Visual Studio Code. Additionally, it also contains an implementation of a registry provider for the common [Docker Registry HTTP API V2](https://docs.docker.com/registry/spec/api/). Most implementations will be a fairly slim inheriting implementation of this.
4+
This package provides the necessary interfaces to implement a registry provider for the [Container Tools extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-containers) for Visual Studio Code. Additionally, it also contains an implementation of a registry provider for the common [Docker Registry HTTP API V2](https://docs.docker.com/registry/spec/api/). Most implementations will be a fairly slim inheriting implementation of this.
55

6-
In order to implement a provider, you must create a VS Code extension which will activate when the Docker explorer view is opened, and register itself with the Docker extension. The Docker extension will call into your provider to discover what nodes to show in the explorer view.
6+
In order to implement a provider, you must create a VS Code extension which will activate when the Container Explorer view is opened, and register itself with the Container Tools extension. The Container Tools extension will call into your provider to discover what nodes to show in the explorer view.
77

88
## When to implement a registry provider extension
99
You should implement a registry provider extension if:
@@ -18,9 +18,9 @@ You should _not_ implement a registry provider extension if:
1818

1919
## How to implement a registry provider extension
2020
1. Create a new VS Code extension. [Learn more](https://code.visualstudio.com/api/get-started/your-first-extension)
21-
1. Add the following activation event to your extension's package.json: `onCommand:vscode-docker.activateRegistryProviders`. [Learn more](https://code.visualstudio.com/api/references/activation-events)
21+
1. Add the following activation event to your extension's package.json: `onCommand:vscode-containers.activateRegistryProviders`. [Learn more](https://code.visualstudio.com/api/references/activation-events)
2222
1. Implement the [`RegistryDataProvider`](https://github.com/microsoft/vscode-docker-extensibility/blob/main/packages/vscode-docker-registries/src/contracts/RegistryDataProvider.ts) interface. The easiest way to do this is to extend either [`CommonRegistryDataProvider`](https://github.com/microsoft/vscode-docker-extensibility/blob/main/packages/vscode-docker-registries/src/clients/Common/CommonRegistryDataProvider.ts) or, if your registry is compliant to the V2 registry spec, [`RegistryV2DataProvider`](https://github.com/microsoft/vscode-docker-extensibility/blob/main/packages/vscode-docker-registries/src/clients/RegistryV2/RegistryV2DataProvider.ts).
23-
1. In your extension's `activate()` method, call into the Docker extension to register your provider. [Learn more](https://github.com/microsoft/vscode-docker-extensibility/blob/main/packages/vscode-docker-registries/src/contracts/DockerExtension.ts)
23+
1. In your extension's `activate()` method, call into the Container Tools extension to register your provider. [Learn more](https://github.com/microsoft/vscode-docker-extensibility/blob/main/packages/vscode-docker-registries/src/contracts/DockerExtension.ts)
2424

2525
## License
2626
[MIT](LICENSE)

0 commit comments

Comments
 (0)