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

Check for and flag outdated images #2073

Merged
merged 14 commits into from
Jul 8, 2020
222 changes: 111 additions & 111 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,114 +1,114 @@
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"env": {
"AZCODE_DOCKER_IGNORE_BUNDLE": "1",
"DEBUGTELEMETRY": "1"
},
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Launch Extension (webpack)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"env": {
"DEBUGTELEMETRY": "1"
},
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: webpack"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/test/test.code-workspace",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}",
"env": {
"AZCODE_DOCKER_IGNORE_BUNDLE": "1",
"MOCHA_grep": "", // RegExp of tests to run (empty means all)
"MOCHA_enableTimeouts": "0", // Disable time-outs
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
},
{
"name": "Launch Tests (unit)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/test/test.code-workspace",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}",
"env": {
"AZCODE_DOCKER_IGNORE_BUNDLE": "1",
"MOCHA_grep": "\\(unit\\)", // RegExp of tests to run (empty means all)
"MOCHA_enableTimeouts": "0", // Disable time-outs
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
},
{
"name": "Launch Tests (webpack)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/test/test.code-workspace",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/dist/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "npm: webpack",
"env": {
"MOCHA_grep": "", // RegExp of tests to run (empty means all)
"MOCHA_enableTimeouts": "0", // Disable time-outs
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
}
]
"version": "0.1.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"env": {
"AZCODE_DOCKER_IGNORE_BUNDLE": "1",
"DEBUGTELEMETRY": "v"
},
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Launch Extension (webpack)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"env": {
"DEBUGTELEMETRY": "1"
},
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: webpack"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/test/test.code-workspace",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}",
"env": {
"AZCODE_DOCKER_IGNORE_BUNDLE": "1",
"MOCHA_grep": "", // RegExp of tests to run (empty means all)
"MOCHA_enableTimeouts": "0", // Disable time-outs
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
},
{
"name": "Launch Tests (unit)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/test/test.code-workspace",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}",
"env": {
"AZCODE_DOCKER_IGNORE_BUNDLE": "1",
"MOCHA_grep": "\\(unit\\)", // RegExp of tests to run (empty means all)
"MOCHA_enableTimeouts": "0", // Disable time-outs
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
},
{
"name": "Launch Tests (webpack)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/test/test.code-workspace",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/dist/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "npm: webpack",
"env": {
"MOCHA_grep": "", // RegExp of tests to run (empty means all)
"MOCHA_enableTimeouts": "0", // Disable time-outs
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
}
]
}
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,11 @@
"type": "boolean",
"default": true,
"description": "%vscode-docker.config.docker.showRemoteWorkspaceWarning%"
},
"docker.checkForOutdatedImages": {
bwateratmsft marked this conversation as resolved.
Show resolved Hide resolved
"type": "boolean",
"default": true,
"description": "%vscode-docker.config.docker.checkForOutdatedImages%"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"vscode-docker.config.docker.dockerComposeBuild": "Set to true to include --build option when docker-compose command is invoked",
"vscode-docker.config.docker.dockerComposeDetached": "Set to true to include --d (detached) option when docker-compose command is invoked",
"vscode-docker.config.docker.showRemoteWorkspaceWarning": "Set to true to prompt to switch from \"UI\" extension mode to \"Workspace\" extension mode if an operation is not supported in UI mode.",
"vscode-docker.config.docker.checkForOutdatedImages": "Whether to check for outdated base images once per session",
"vscode-docker.config.deprecated": "This setting has been deprecated and will be removed in a future release.",
"vscode-docker.commands.api.configure": "Add Docker Files to Workspace (API)...",
"vscode-docker.commands.compose.down": "Compose Down",
Expand Down
8 changes: 0 additions & 8 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ export const configPrefix: string = 'docker';
// Consider downloading multiple pages (images, tags, etc)
export const PAGE_SIZE = 100;

export namespace keytarConstants {
export const serviceId: string = 'vscode-docker';

export const dockerHubTokenKey: string = 'dockerhub.token';
export const dockerHubUserNameKey: string = 'dockerhub.username';
export const dockerHubPasswordKey: string = 'dockerhub.password';
}

export namespace configurationKeys {
export const groupImagesBy = 'groupImagesBy';
}
Expand Down
7 changes: 6 additions & 1 deletion src/tree/images/ImageTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Image } from 'dockerode';
import { AzExtParentTreeItem, AzExtTreeItem, IActionContext } from "vscode-azureextensionui";
import { ext } from '../../extensionVariables';
import { localize } from '../../localize';
import { callDockerode, callDockerodeWithErrorHandling } from '../../utils/callDockerode';
import { getThemedIconPath, IconPath } from '../IconPath';
import { ILocalImageInfo } from './LocalImageInfo';
Expand Down Expand Up @@ -41,10 +42,14 @@ export class ImageTreeItem extends AzExtTreeItem {
}

public get description(): string | undefined {
return ext.imagesRoot.getTreeItemDescription(this._item);
return `${ext.imagesRoot.getTreeItemDescription(this._item)}${this._item.outdated ? localize('vscode-docker.tree.images.outdated', ' (Out of date)') : ''}`;
}

public get iconPath(): IconPath {
if (this._item.outdated) {
return getThemedIconPath('statusWarning');
}

let icon: string;
switch (ext.imagesRoot.labelSetting) {
case 'Tag':
Expand Down
5 changes: 5 additions & 0 deletions src/tree/images/ImagesTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ import { ImageGroupTreeItem } from './ImageGroupTreeItem';
import { getImagePropertyValue, imageProperties, ImageProperty } from "./ImageProperties";
import { ImageTreeItem } from "./ImageTreeItem";
import { ILocalImageInfo, LocalImageInfo } from "./LocalImageInfo";
import { OutdatedImageChecker } from "./OutdatedImageChecker";

export class ImagesTreeItem extends LocalRootTreeItemBase<ILocalImageInfo, ImageProperty> {
private readonly outdatedImageChecker: OutdatedImageChecker = new OutdatedImageChecker();

public treePrefix: string = 'images';
public label: string = localize('vscode-docker.tree.images.label', 'Images');
public configureExplorerTitle: string = localize('vscode-docker.tree.images.configure', 'Configure images explorer');
Expand Down Expand Up @@ -61,6 +64,8 @@ export class ImagesTreeItem extends LocalRootTreeItemBase<ILocalImageInfo, Image
}
}

this.outdatedImageChecker.markOutdatedImages(result);

return result;
}

Expand Down
2 changes: 2 additions & 0 deletions src/tree/images/LocalImageInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface ILocalImageInfo extends ILocalItem {
fullTag: string;
imageId: string;
repoDigests?: string[];
outdated?: boolean;
}

/**
Expand All @@ -21,6 +22,7 @@ export interface ILocalImageInfo extends ILocalItem {
export class LocalImageInfo implements ILocalImageInfo {
public data: ImageInfo;
public fullTag: string;
public outdated: boolean = false;
public constructor(data: ImageInfo, fullTag: string) {
this.data = data;
this.fullTag = fullTag;
Expand Down
Loading