bug fixes

This commit is contained in:
Jyotsna
2020-11-18 20:13:57 +05:30
parent faf09632f3
commit c3ad59d720
4 changed files with 27 additions and 14 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ function getWorkflowAnnotationsJson(lastSuccessRunSha, workflowFilePath, filePat
+ `'lastSuccessRunCommit': '${lastSuccessRunSha}',`
+ `'branch': '${process.env.GITHUB_REF}',`
+ `'deployTimestamp': '${Date.now()}',`
+ `'filePathConfigs': '${JSON.stringify(filePathConfigs)}',`
+ `'filePathConfigs': ${JSON.stringify(filePathConfigs)},`
+ `'provider': 'GitHub'`
+ `}`;
}
+11 -6
View File
@@ -148,8 +148,8 @@ function getFilePathsConfigs() {
const DOCKERFILE_PATH_LABEL_KEY = 'dockerfile-path';
const DOCKERFILE_PATH_KEY = 'dockerfilePath';
const CONTAINER_REG_KEY = 'containerRegistryServer';
let inputManifestFiles = inputParams.manifests;
filePathsConfig[MANIFEST_PATHS_KEY] = inputManifestFiles || '';
let inputManifestFiles = inputParams.manifests || [];
filePathsConfig[MANIFEST_PATHS_KEY] = inputManifestFiles;
let helmChartPath = process.env.HELM_CHART_PATH || '';
filePathsConfig[HELM_CHART_KEY] = helmChartPath;
//Fetch labels from each image
@@ -180,19 +180,24 @@ function getFilePathsConfigs() {
if (res.stderr != '' && !res.success) {
throw new Error(`docker inspect call failed with: ${res.stderr.match(/(.*)\s*$/)[0]}`);
}
resultObj = JSON.parse(res.stdout)[0];
if (res.stdout != null && res.stdout != '') {
resultObj = JSON.parse(res.stdout);
}
});
}
catch (ex) {
core.warning(`Failed to get dockerfile paths for image ${image.toString()} | ` + ex);
}
if (resultObj != null && resultObj.Config != null && resultObj.Config.Labels != null) {
if (resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY] != null) {
if (resultObj != null) {
resultObj = resultObj[0];
if (resultObj.Config != null && resultObj.Config.Labels != null && resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY] != null) {
buildConfigMap[DOCKERFILE_PATH_KEY] = resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY];
}
//Add CR server name to build config
buildConfigMap[CONTAINER_REG_KEY] = containerRegistryName;
imageToBuildConfigMap[resultObj.Id] = buildConfigMap;
if (resultObj.Id != null) {
imageToBuildConfigMap[resultObj.Id] = buildConfigMap;
}
}
}
filePathsConfig[BUILD_CONFIG_KEY] = imageToBuildConfigMap;