From f4892cc068c12620fb1908e53e20d9acd1957f22 Mon Sep 17 00:00:00 2001 From: dabasnidhi Date: Tue, 4 Jun 2019 16:25:29 +0530 Subject: [PATCH 1/3] Swallow exceptions encountered in getHistory for DockerV2 task --- Tasks/Common/docker-common/dockercommandutils.ts | 11 +++++++++-- Tasks/DockerComposeV0/task.json | 4 ++-- Tasks/DockerComposeV0/task.loc.json | 4 ++-- Tasks/DockerV0/task.json | 4 ++-- Tasks/DockerV0/task.loc.json | 4 ++-- Tasks/DockerV1/task.json | 4 ++-- Tasks/DockerV1/task.loc.json | 4 ++-- Tasks/DockerV2/dockerpush.ts | 4 ++++ Tasks/DockerV2/task.json | 4 ++-- Tasks/DockerV2/task.loc.json | 4 ++-- Tasks/KubernetesV0/task.json | 4 ++-- Tasks/KubernetesV0/task.loc.json | 4 ++-- Tasks/KubernetesV1/task.json | 4 ++-- Tasks/KubernetesV1/task.loc.json | 4 ++-- 14 files changed, 37 insertions(+), 26 deletions(-) diff --git a/Tasks/Common/docker-common/dockercommandutils.ts b/Tasks/Common/docker-common/dockercommandutils.ts index 7718180e5a0d..ed645b6424b7 100644 --- a/Tasks/Common/docker-common/dockercommandutils.ts +++ b/Tasks/Common/docker-common/dockercommandutils.ts @@ -83,6 +83,10 @@ export function getCommandArguments(args: string): string { export async function getLayers(connection: ContainerConnection, imageId: string): Promise { var layers = []; var history = await getHistory(connection, imageId); + if (!history) { + return null; + } + var lines = history.split(/[\r?\n]/); lines.forEach(line => { @@ -178,8 +182,11 @@ async function getHistory(connection: ContainerConnection, image: string): Promi }); } catch (e) { - defer.reject(e); - console.log(e); + // Swallow any exceptions encountered in executing command + // such as --format flag not supported in old docker cli versions + output = null; + defer.resolve(); + tl.warning(e); } await defer.promise; diff --git a/Tasks/DockerComposeV0/task.json b/Tasks/DockerComposeV0/task.json index ae0e70e3bbfb..7cebd4d6b5d7 100644 --- a/Tasks/DockerComposeV0/task.json +++ b/Tasks/DockerComposeV0/task.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "preview": "false", diff --git a/Tasks/DockerComposeV0/task.loc.json b/Tasks/DockerComposeV0/task.loc.json index 7283cdc1a21b..9cab8923ce35 100644 --- a/Tasks/DockerComposeV0/task.loc.json +++ b/Tasks/DockerComposeV0/task.loc.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "preview": "false", diff --git a/Tasks/DockerV0/task.json b/Tasks/DockerV0/task.json index dd838fa7e1f5..2ec2403eb43e 100644 --- a/Tasks/DockerV0/task.json +++ b/Tasks/DockerV0/task.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "preview": "false", diff --git a/Tasks/DockerV0/task.loc.json b/Tasks/DockerV0/task.loc.json index 7f90ee971575..2219b1a8a161 100644 --- a/Tasks/DockerV0/task.loc.json +++ b/Tasks/DockerV0/task.loc.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "preview": "false", diff --git a/Tasks/DockerV1/task.json b/Tasks/DockerV1/task.json index 118702b54686..3a272bf545de 100644 --- a/Tasks/DockerV1/task.json +++ b/Tasks/DockerV1/task.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "releaseNotes": "Simplified the task by:
 - Providing an option to simply select or type a command.
 - Retaining the useful input fields and providing an option to pass the rest as an argument to the command.", diff --git a/Tasks/DockerV1/task.loc.json b/Tasks/DockerV1/task.loc.json index 47583cee5992..0a4c1204e2cc 100644 --- a/Tasks/DockerV1/task.loc.json +++ b/Tasks/DockerV1/task.loc.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "releaseNotes": "ms-resource:loc.releaseNotes", diff --git a/Tasks/DockerV2/dockerpush.ts b/Tasks/DockerV2/dockerpush.ts index 2f4ea4eabfb9..ea87f9f02b90 100644 --- a/Tasks/DockerV2/dockerpush.ts +++ b/Tasks/DockerV2/dockerpush.ts @@ -124,6 +124,10 @@ async function publishToImageMetadataStore(connection: ContainerConnection, imag const imageUri = getResourceName(imageName, digest); const baseImageName = dockerFilePath ? getBaseImageNameFromDockerFile(dockerFilePath) : "NA"; const layers = await dockerCommandUtils.getLayers(connection, imageName); + if (!layers) { + return null; + } + const imageSize = dockerCommandUtils.getImageSize(layers); // Getting pipeline variables diff --git a/Tasks/DockerV2/task.json b/Tasks/DockerV2/task.json index 4ce673a64251..67215a1b42e3 100644 --- a/Tasks/DockerV2/task.json +++ b/Tasks/DockerV2/task.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "releaseNotes": "Simplified the task YAML by:
 - Removing the Container registry type input
 - Removing complex inputs as they can be passed as arguments to the command.", diff --git a/Tasks/DockerV2/task.loc.json b/Tasks/DockerV2/task.loc.json index 46ad8bb9a936..4438179865c6 100644 --- a/Tasks/DockerV2/task.loc.json +++ b/Tasks/DockerV2/task.loc.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "releaseNotes": "ms-resource:loc.releaseNotes", diff --git a/Tasks/KubernetesV0/task.json b/Tasks/KubernetesV0/task.json index 9e47be33ce01..7140487e0102 100644 --- a/Tasks/KubernetesV0/task.json +++ b/Tasks/KubernetesV0/task.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "preview": "false", diff --git a/Tasks/KubernetesV0/task.loc.json b/Tasks/KubernetesV0/task.loc.json index 430f4c68d881..b566b7104bbf 100644 --- a/Tasks/KubernetesV0/task.loc.json +++ b/Tasks/KubernetesV0/task.loc.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "preview": "false", diff --git a/Tasks/KubernetesV1/task.json b/Tasks/KubernetesV1/task.json index 62a91d07bf06..ef570fb82c5e 100644 --- a/Tasks/KubernetesV1/task.json +++ b/Tasks/KubernetesV1/task.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "releaseNotes": "What's new in Version 1.0:
 Added new service connection type input for easy selection of Azure AKS cluster.
 Replaced output variable input with output variables section that we had added in all tasks.", diff --git a/Tasks/KubernetesV1/task.loc.json b/Tasks/KubernetesV1/task.loc.json index 6d55794aad77..f28c3df3270e 100644 --- a/Tasks/KubernetesV1/task.loc.json +++ b/Tasks/KubernetesV1/task.loc.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 153, - "Patch": 3 + "Minor": 154, + "Patch": 0 }, "demands": [], "releaseNotes": "ms-resource:loc.releaseNotes", From 2fa28483a17407a15c3a41501d7d48fc1aad5298 Mon Sep 17 00:00:00 2001 From: dabasnidhi Date: Tue, 4 Jun 2019 17:50:08 +0530 Subject: [PATCH 2/3] Updated task version for KubernetesManifestV0 --- Tasks/KubernetesManifestV0/task.json | 4 ++-- Tasks/KubernetesManifestV0/task.loc.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tasks/KubernetesManifestV0/task.json b/Tasks/KubernetesManifestV0/task.json index a94129ae2377..634d91ba952b 100644 --- a/Tasks/KubernetesManifestV0/task.json +++ b/Tasks/KubernetesManifestV0/task.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 153, - "Patch": 4 + "Minor": 154, + "Patch": 0 }, "demands": [], "groups": [], diff --git a/Tasks/KubernetesManifestV0/task.loc.json b/Tasks/KubernetesManifestV0/task.loc.json index 2b06329c5945..d9e0a8307484 100644 --- a/Tasks/KubernetesManifestV0/task.loc.json +++ b/Tasks/KubernetesManifestV0/task.loc.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 153, - "Patch": 4 + "Minor": 154, + "Patch": 0 }, "demands": [], "groups": [], From c9de4ea66a13ce6afa44bd700f0d4da7395a2d5b Mon Sep 17 00:00:00 2001 From: dabasnidhi Date: Thu, 6 Jun 2019 12:20:32 +0530 Subject: [PATCH 3/3] Updated warning for getHistory --- Tasks/Common/docker-common/dockercommandutils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/Common/docker-common/dockercommandutils.ts b/Tasks/Common/docker-common/dockercommandutils.ts index ed645b6424b7..3f11c44e95fb 100644 --- a/Tasks/Common/docker-common/dockercommandutils.ts +++ b/Tasks/Common/docker-common/dockercommandutils.ts @@ -186,7 +186,7 @@ async function getHistory(connection: ContainerConnection, image: string): Promi // such as --format flag not supported in old docker cli versions output = null; defer.resolve(); - tl.warning(e); + tl.warning("Not publishing to image meta data store as get history failed with error " + e); } await defer.promise;