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

Change run commands to use imageId instead of tag #4112

Merged
merged 4 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
3 changes: 2 additions & 1 deletion src/commands/images/runImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ async function runImageCore(context: IActionContext, node: ImageTreeItem | undef
const terminalCommand = await selectRunCommand(
context,
node.fullTag,
node.imageId,
interactive,
inspectResult?.[0]?.ports
);

const taskCRF = new TaskCommandRunnerFactory(
{
taskName: node.fullTag,
taskName: node.fullTag !== '<none>' ? node.fullTag : node.imageId,
bwateratmsft marked this conversation as resolved.
Show resolved Hide resolved
alwaysRunNew: interactive,
}
);
Expand Down
8 changes: 5 additions & 3 deletions src/commands/selectCommandTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,20 @@ export async function selectBuildCommand(context: IActionContext, folder: vscode
);
}

export async function selectRunCommand(context: IActionContext, fullTag: string, interactive: boolean, exposedPorts?: PortBinding[]): Promise<VoidCommandResponse> {
export async function selectRunCommand(context: IActionContext, fullTag: string, imageId: string, interactive: boolean, exposedPorts?: PortBinding[]): Promise<VoidCommandResponse> {
let portsString: string = '';
if (exposedPorts) {
portsString = exposedPorts.map(pb => `-p ${pb.containerPort}:${pb.containerPort}${pb.protocol ? '/' + pb.protocol : ''}`).join(' ');
}

const tagOrImageId = fullTag !== '<none>' ? fullTag : imageId;
jnsjunior marked this conversation as resolved.
Show resolved Hide resolved

return await selectCommandTemplate(
context,
interactive ? 'runInteractive' : 'run',
[fullTag],
[fullTag, imageId],
undefined,
{ 'tag': fullTag, 'exposedPorts': portsString, 'containerCommand': await ext.runtimeManager.getCommand() }
{ 'tag': tagOrImageId, 'exposedPorts': portsString, 'containerCommand': await ext.runtimeManager.getCommand() }
);
}

Expand Down