Skip to content
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

Add a client for Podman #222

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
30 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
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
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`
*/
public readonly defaultFormatForJson: string = "{{ json . }}";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we match the default of "{{json .}}" without the extra whitespace?


//#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,10 @@

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

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

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