Skip to content

Commit

Permalink
Add a way to view image manifest (#4134)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored Oct 25, 2023
1 parent 596916b commit e882270
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
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 @@ -490,10 +490,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",
Expand Down Expand Up @@ -2583,6 +2588,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 @@ -2993,7 +3003,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);
}

0 comments on commit e882270

Please sign in to comment.