Skip to content

Add a client for Podman #222

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

Merged
merged 41 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
14b2fde
Add back Podman client
bwateratmsft Jan 17, 2024
8e18733
Implement some of the Podman commands
bwateratmsft Jan 19, 2024
bb0b7e0
Add image prune and inspect
bwateratmsft Jan 19, 2024
d62f50e
Add test for prune image
bwateratmsft Jan 19, 2024
613a492
Commit current progress
bwateratmsft Jan 19, 2024
3ef619e
Rename PodmanListImageRecord
bwateratmsft Jan 19, 2024
b12fe59
Add listNetworks command
bwateratmsft Jan 19, 2024
2db7a11
Add networks and volumes commands
bwateratmsft Jan 22, 2024
e35642c
Fix bug
bwateratmsft Jan 22, 2024
38a2831
Create volumes
bwateratmsft Jan 22, 2024
d3ff84d
Add filesystem tests
bwateratmsft Jan 22, 2024
c6a98ae
Clean up
bwateratmsft Jan 22, 2024
66e59fc
Fix E2E test time taken
bwateratmsft Jan 22, 2024
f00b41b
Rename tests
bwateratmsft Jan 23, 2024
290a139
Export Podman client
bwateratmsft Jan 24, 2024
e5d48d4
Multiple images of same name
bwateratmsft Jan 24, 2024
2e1b8b3
Disable Podman E2E tests
bwateratmsft Jan 24, 2024
ea48c15
Use `--format json` for Podman
bwateratmsft Jan 25, 2024
3c765d7
Update network records to be more strict
bwateratmsft Jan 25, 2024
8c48727
Stop leaving around orphaned containers
bwateratmsft Jan 25, 2024
9995af8
Implement login and logout test
bwateratmsft Jan 25, 2024
35037fa
Rename runner
bwateratmsft Jan 25, 2024
594366c
Fix linter error
bwateratmsft Jan 25, 2024
7feba90
Remove dead code
bwateratmsft Jan 25, 2024
3afdb5a
Merge branch 'main' into bmw/podman
bwateratmsft Feb 6, 2024
c09866c
David's feedback
bwateratmsft Feb 15, 2024
c025fdb
Remove unused property
bwateratmsft Feb 15, 2024
117e66e
Add wslify utility
bwateratmsft Feb 15, 2024
7f6d940
Make tests neater
bwateratmsft Feb 15, 2024
6baf4ca
Comments at the top
bwateratmsft Feb 15, 2024
c54acd1
Merge branch 'main' into bmw/podman
bwateratmsft Jan 13, 2025
ac2906e
Merge branch 'main' into bmw/podman
bwateratmsft Jan 29, 2025
b105338
Fix v5 event stream issue
bwateratmsft Feb 3, 2025
b1cb73d
Fix for host IP being blank in container listing
bwateratmsft Feb 3, 2025
9788a5a
Update version, changelog, notices for v 0.2.0 release
bwateratmsft Feb 10, 2025
0b0c3c1
Merge branch 'main' into bmw/podman
bwateratmsft Feb 20, 2025
3fb89a0
Fix usage of dayjs
bwateratmsft Mar 3, 2025
9ce71bf
Make default format arg protected
bwateratmsft Mar 4, 2025
cdff189
Remove Dockerfile
bwateratmsft Mar 6, 2025
0ecdc68
Add .gitignore
bwateratmsft Mar 6, 2025
c106e91
Update test
bwateratmsft Mar 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/vscode-container-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.2.0 - 10 February 2025
### Added
* Added a client for Podman. [#221](https://github.com/microsoft/vscode-docker-extensibility/issues/221)

### Changed
* Some properties on certain objects have become optional, due to Podman not containing them. For example, network ID on network listing is not present on Podman v3.

## 0.1.2 - 1 August 2024
### Fixed
* Listing files fails due to new Bash behavior. [#231](https://github.com/microsoft/vscode-docker-extensibility/issues/231)
Expand Down
225 changes: 74 additions & 151 deletions packages/vscode-container-client/NOTICE.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/vscode-container-client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microsoft/vscode-container-client",
"author": "Microsoft Corporation",
"version": "0.1.2",
"version": "0.2.0",
"description": "Extensibility model for implementing container runtime providers (shared by VS and VS Code)",
"license": "See LICENSE in the project root for license information.",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class DockerClient extends DockerClientBase implements IContainersClient
private getListContextsCommandArgs(options: ListContextsCommandOptions): CommandLineArgs {
return composeArgs(
withArg('context', 'ls'),
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
)();
}

Expand Down Expand Up @@ -156,7 +156,7 @@ export class DockerClient extends DockerClientBase implements IContainersClient
private getInspectContextsCommandArgs(options: InspectContextsCommandOptions): CommandLineArgs {
return composeArgs(
withArg('context', 'inspect'),
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
withArg(...options.contexts),
)();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,19 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
*/
public readonly defaultTag: string = 'latest';

/**
* The default argument given to `--format`
*/
protected readonly defaultFormatForJson: string = "{{json .}}";

//#region Information Commands

protected getInfoCommandArgs(
options: InfoCommandOptions,
): CommandLineArgs {
return composeArgs(
withArg('info'),
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
)();
}

Expand Down Expand Up @@ -173,7 +178,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
protected getVersionCommandArgs(options: VersionCommandOptions): CommandLineArgs {
return composeArgs(
withArg('version'),
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
)();
}

Expand Down Expand Up @@ -243,7 +248,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
withDockerLabelFilterArgs(options.labels),
withDockerFilterArg(options.types?.map((type) => `type=${type}`)),
withDockerFilterArg(options.events?.map((event) => `event=${event}`)),
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
)();
}

Expand Down Expand Up @@ -391,7 +396,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
withDockerFilterArg(options.references?.map((reference) => `reference=${reference}`)),
withDockerLabelFilterArgs(options.labels),
withDockerNoTruncArg,
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
)();
}

Expand Down Expand Up @@ -462,7 +467,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo

protected getRemoveImagesCommandArgs(options: RemoveImagesCommandOptions): CommandLineArgs {
return composeArgs(
withArg('image', 'remove'),
withArg('image', 'rm'), // Docker supports both `remove` and `rm`, but Podman supports only `rm`
withFlagArg('--force', options.force),
withArg(...options.imageRefs),
)();
Expand Down Expand Up @@ -602,7 +607,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
): CommandLineArgs {
return composeArgs(
withArg('image', 'inspect'),
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
withArg(...options.imageRefs),
)();
}
Expand Down Expand Up @@ -770,7 +775,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
withDockerFilterArg(options.volumes?.map((volume) => `volume=${volume}`)),
withDockerFilterArg(options.networks?.map((network) => `network=${network}`)),
withDockerNoTruncArg,
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
withDockerIgnoreSizeArg,
)();
}
Expand Down Expand Up @@ -1046,7 +1051,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
): CommandLineArgs {
return composeArgs(
withArg('container', 'inspect'),
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
withArg(...options.containers)
)();
}
Expand Down Expand Up @@ -1117,7 +1122,6 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
withArg('volume', 'create'),
withNamedArg('--driver', options.driver),
withArg(options.name),
withDockerJsonFormatArg,
)();
}

Expand All @@ -1138,11 +1142,11 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
withDockerBooleanFilterArg('dangling', options.dangling),
withDockerFilterArg(options.driver ? `driver=${options.driver}` : undefined),
withDockerLabelFilterArgs(options.labels),
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
)();
}

protected async parseListVolumesCommandOputput(
protected async parseListVolumesCommandOutput(
options: ListVolumesCommandOptions,
output: string,
strict: boolean,
Expand Down Expand Up @@ -1198,7 +1202,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
return {
command: this.commandName,
args: this.getListVolumesCommandArgs(options),
parse: (output, strict) => this.parseListVolumesCommandOputput(options, output, strict),
parse: (output, strict) => this.parseListVolumesCommandOutput(options, output, strict),
};
}

Expand Down Expand Up @@ -1292,7 +1296,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
): CommandLineArgs {
return composeArgs(
withArg('volume', 'inspect'),
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
withArg(...options.volumes),
)();
}
Expand Down Expand Up @@ -1375,7 +1379,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
withArg('network', 'ls'),
withDockerLabelFilterArgs(options.labels),
withDockerNoTruncArg,
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
)();
}

Expand Down Expand Up @@ -1495,7 +1499,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
): CommandLineArgs {
return composeArgs(
withArg('network', 'inspect'),
withDockerJsonFormatArg,
withDockerJsonFormatArg(this.defaultFormatForJson),
withArg(...options.networks),
)();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@

import { withNamedArg } from '../../utils/commandLineBuilder';

export const withDockerJsonFormatArg = withNamedArg('--format', '{{json .}}');
export function withDockerJsonFormatArg(jsonFormat: string = '{{json .}}') {
return withNamedArg('--format', jsonFormat);
}
Loading