diff --git a/package-lock.json b/package-lock.json index f4140e0c96..5089888da0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,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", @@ -813,9 +813,9 @@ } }, "node_modules/@microsoft/vscode-docker-registries": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-docker-registries/-/vscode-docker-registries-0.1.5.tgz", - "integrity": "sha512-RJGj9sAhJ3j2wdloAVDgEx8pIK/CppAW1oUIgyOWLUu7lMTqIuEJDysrohsC5Ap4mZKQV5Gw7K/+A/f1rAaDOA==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-docker-registries/-/vscode-docker-registries-0.1.6.tgz", + "integrity": "sha512-S5WtHUuPU54ic8A27eMKJNEUmmOZyTTpHt4zYRbFuTBP5w9vxfAYOoaDJ8dMrfD4qNFH+EWAhNaJzQZ0Fo6dvQ==", "dependencies": { "dayjs": "^1.11.7", "node-fetch": "^2.6.11" diff --git a/package.json b/package.json index c0d21b1fdd..03ff73cae9 100644 --- a/package.json +++ b/package.json @@ -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)", + "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", @@ -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%", @@ -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", diff --git a/package.nls.json b/package.nls.json index 88dc4fe915..873b3dfd53 100644 --- a/package.nls.json +++ b/package.nls.json @@ -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...", diff --git a/src/commands/registerCommands.ts b/src/commands/registerCommands.ts index e317a03568..173b2f6d18 100644 --- a/src/commands/registerCommands.ts +++ b/src/commands/registerCommands.ts @@ -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"; @@ -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); diff --git a/src/commands/registries/inspectRemoteImageManifest.ts b/src/commands/registries/inspectRemoteImageManifest.ts new file mode 100644 index 0000000000..9e5261bfc5 --- /dev/null +++ b/src/commands/registries/inspectRemoteImageManifest.ts @@ -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): Promise { + if (!node) { + node = await registryExperience(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); +}