From 52883f32648b529e649581652094b25845866d00 Mon Sep 17 00:00:00 2001 From: Jyotsna Date: Mon, 23 Nov 2020 14:19:50 +0530 Subject: [PATCH] review comments changes --- lib/utilities/utility.js | 6 +++--- src/utilities/utility.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/utilities/utility.js b/lib/utilities/utility.js index 8582bd61..0dccee26 100644 --- a/lib/utilities/utility.js +++ b/lib/utilities/utility.js @@ -177,7 +177,7 @@ function getFilePathsConfigs() { if (res.stderr != '' && !res.success) { throw new Error(`docker inspect call failed with: ${res.stderr.match(/(.*)\s*$/)[0]}`); } - if (!res.stdout) { + if (res.stdout) { resultObj = JSON.parse(res.stdout); } }); @@ -185,9 +185,9 @@ function getFilePathsConfigs() { catch (ex) { core.warning(`Failed to get dockerfile paths for image ${image.toString()} | ` + ex); } - if (!resultObj) { + if (resultObj) { resultObj = resultObj[0]; - if (!(resultObj.Config) && !(resultObj.Config.Labels) && !(resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY])) { + if ((resultObj.Config) && (resultObj.Config.Labels) && (resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY])) { imageToBuildConfigMap[image] = resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY]; } } diff --git a/src/utilities/utility.ts b/src/utilities/utility.ts index ca493f8c..496bea54 100644 --- a/src/utilities/utility.ts +++ b/src/utilities/utility.ts @@ -176,7 +176,7 @@ export async function getFilePathsConfigs(): Promise { throw new Error(`docker inspect call failed with: ${res.stderr.match(/(.*)\s*$/)![0]}`); } - if(!res.stdout){ + if(res.stdout){ resultObj = JSON.parse(res.stdout); } }); @@ -185,9 +185,9 @@ export async function getFilePathsConfigs(): Promise { core.warning(`Failed to get dockerfile paths for image ${image.toString()} | ` + ex); } - if(!resultObj){ + if(resultObj){ resultObj = resultObj[0]; - if(!(resultObj.Config) && !(resultObj.Config.Labels) && !(resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY])){ + if((resultObj.Config) && (resultObj.Config.Labels) && (resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY])){ imageToBuildConfigMap[image] = resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY]; } }