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 way to view image manifest #4134

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions package-lock.json

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

14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,15 @@
"when": "view == dockerRegistries && viewItem =~ /commontag/i && !(viewItem =~ /commontag;.*dockerhub/i)",
"group": "regs_tag_1_general@3"
},
{
"command": "vscode-docker.registries.inspectRemoteImageManifest",
"when": "view == dockerRegistries && viewItem =~ /commontag/i && !(viewItem =~ /commontag;.*dockerhub/i)",
bwateratmsft marked this conversation as resolved.
Show resolved Hide resolved
"group": "regs_tag_1_general@4"
},
{
"command": "vscode-docker.registries.deployImageToAzure",
"when": "view == dockerRegistries && viewItem =~ /commontag/i",
"group": "regs_tag_1_general@4"
"group": "regs_tag_1_general@5"
},
{
"command": "vscode-docker.registries.deployImageToAca",
Expand Down Expand Up @@ -2597,6 +2602,11 @@
"title": "%vscode-docker.commands.registries.copyImageDigest%",
"category": "%vscode-docker.commands.category.dockerRegistries%"
},
{
"command": "vscode-docker.registries.inspectRemoteImageManifest",
"title": "%vscode-docker.commands.registries.inspectRemoteImageManifest%",
"category": "%vscode-docker.commands.category.dockerRegistries%"
},
{
"command": "vscode-docker.registries.copyRemoteFullTag",
"title": "%vscode-docker.commands.registries.copyRemoteFullTag%",
Expand Down Expand Up @@ -3007,7 +3017,7 @@
"@microsoft/vscode-azext-azureutils": "^2.0.0",
"@microsoft/vscode-azext-utils": "^2.1.1",
"@microsoft/vscode-container-client": "^0.1.1",
"@microsoft/vscode-docker-registries": "^0.1.5",
"@microsoft/vscode-docker-registries": "^0.1.6",
"dayjs": "^1.11.7",
"dockerfile-language-server-nodejs": "^0.11.0",
"fs-extra": "^11.1.1",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
"vscode-docker.commands.registries.connect": "Connect Registry...",
"vscode-docker.commands.registries.reconnectRegistry": "Re-enter credentials",
"vscode-docker.commands.registries.copyImageDigest": "Copy Image Digest",
"vscode-docker.commands.registries.inspectRemoteImageManifest": "Inspect Image Manifest",
"vscode-docker.commands.registries.copyRemoteFullTag": "Copy Full Tag",
"vscode-docker.commands.registries.deleteImage": "Delete Image...",
"vscode-docker.commands.registries.deployImageToAzure": "Deploy Image to Azure App Service...",
Expand Down
2 changes: 2 additions & 0 deletions src/commands/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import { disconnectRegistry } from "./registries/disconnectRegistry";
import { openDockerHubInBrowser } from "./registries/dockerHub/openDockerHubInBrowser";
import { addTrackedGenericV2Registry } from "./registries/genericV2/addTrackedGenericV2Registry";
import { removeTrackedGenericV2Registry } from "./registries/genericV2/removeTrackedGenericV2Registry";
import { inspectRemoteImageManifest } from "./registries/inspectRemoteImageManifest";
import { logInToDockerCli } from "./registries/logInToDockerCli";
import { logOutOfDockerCli } from "./registries/logOutOfDockerCli";
import { pullImageFromRepository, pullRepository } from "./registries/pullImages";
Expand Down Expand Up @@ -167,6 +168,7 @@ export function registerCommands(): void {

registerCommand('vscode-docker.registries.connectRegistry', connectRegistry);
registerCommand('vscode-docker.registries.copyImageDigest', copyRemoteImageDigest);
registerCommand('vscode-docker.registries.inspectRemoteImageManifest', inspectRemoteImageManifest);
registerCommand('vscode-docker.registries.copyRemoteFullTag', copyRemoteFullTag);
registerCommand('vscode-docker.registries.deleteImage', deleteRemoteImage);
registerCommand('vscode-docker.registries.deployImageToAzure', deployImageToAzure);
Expand Down
24 changes: 24 additions & 0 deletions src/commands/registries/inspectRemoteImageManifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { IActionContext, openReadOnlyJson } from "@microsoft/vscode-azext-utils";
import { CommonTag, RegistryV2DataProvider } from "@microsoft/vscode-docker-registries";
import { ext } from "../../extensionVariables";
import { UnifiedRegistryItem } from "../../tree/registries/UnifiedRegistryTreeDataProvider";
import { registryExperience } from "../../utils/registryExperience";

export async function inspectRemoteImageManifest(context: IActionContext, node?: UnifiedRegistryItem<CommonTag>): Promise<void> {
if (!node) {
node = await registryExperience<CommonTag>(context, {
registryFilter: { exclude: [ext.dockerHubRegistryDataProvider.label] },
contextValueFilter: { include: /commontag/i, },
});
}

const v2DataProvider = node.provider as unknown as RegistryV2DataProvider;
const manifest = await v2DataProvider.getManifestV1(node.wrappedItem);

await openReadOnlyJson({ label: node.wrappedItem.label, fullId: node.wrappedItem.id || node.wrappedItem.label }, manifest);
}