review comments changes

This commit is contained in:
Jyotsna 2020-11-23 14:19:50 +05:30
parent ef8defce31
commit 52883f3264
2 changed files with 6 additions and 6 deletions

View File

@ -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];
}
}

View File

@ -176,7 +176,7 @@ export async function getFilePathsConfigs(): Promise<any> {
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<any> {
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];
}
}