JSON structure fixes

This commit is contained in:
Jyotsna 2020-11-23 15:15:26 +05:30
parent d953c709a5
commit 27085d52d5
4 changed files with 20 additions and 10 deletions

View File

@ -38,9 +38,9 @@ function getWorkflowAnnotationsJson(lastSuccessRunSha, workflowFilePath, filePat
+ `'lastSuccessRunCommit': '${lastSuccessRunSha}',`
+ `'branch': '${process.env.GITHUB_REF}',`
+ `'deployTimestamp': '${Date.now()}',`
+ `'dockerfilePaths': '${JSON.stringify(filePathConfigs.dockerfilePaths)}',`
+ `'manifestsPaths': '${JSON.stringify(filePathConfigs.manifestFilePaths)}',`
+ `'helmChartPaths': '${JSON.stringify(filePathConfigs.helmChartFilePaths)}',`
+ `'dockerfilePaths': '${JSON.stringify(filePathConfigs.dockerfilePaths, null, 2)}',`
+ `'manifestsPaths': '${JSON.stringify(filePathConfigs.manifestFilePaths, null, 2)}',`
+ `'helmChartPaths': '${JSON.stringify(filePathConfigs.helmChartFilePaths, null, 2)}',`
+ `'provider': 'GitHub'`
+ `}`;
}

View File

@ -148,8 +148,12 @@ function getFilePathsConfigs() {
const DOCKERFILE_PATH_LABEL_KEY = 'dockerfile-path';
let inputManifestFiles = inputParams.manifests || [];
filePathsConfig[MANIFEST_PATHS_KEY] = inputManifestFiles;
let helmChartPaths = process.env.HELM_CHART_PATHS || '';
filePathsConfig[HELM_CHART_KEY] = helmChartPaths.split('\n');
let helmChartPaths = [];
if (process.env.HELM_CHART_PATHS) {
helmChartPaths = process.env.HELM_CHART_PATHS.split('\n');
helmChartPaths.filter(val => val != "");
}
filePathsConfig[HELM_CHART_KEY] = helmChartPaths;
//Fetch labels from each image
let imageNames = core.getInput('images').split('\n');
let imageDockerfilePathList = [];

View File

@ -38,9 +38,9 @@ export function getWorkflowAnnotationsJson(lastSuccessRunSha: string, workflowFi
+ `'lastSuccessRunCommit': '${lastSuccessRunSha}',`
+ `'branch': '${process.env.GITHUB_REF}',`
+ `'deployTimestamp': '${Date.now()}',`
+ `'dockerfilePaths': '${JSON.stringify(filePathConfigs.dockerfilePaths)}',`
+ `'manifestsPaths': '${JSON.stringify(filePathConfigs.manifestFilePaths)}',`
+ `'helmChartPaths': '${JSON.stringify(filePathConfigs.helmChartFilePaths)}',`
+ `'dockerfilePaths': '${JSON.stringify(filePathConfigs.dockerfilePaths,null,2)}',`
+ `'manifestsPaths': '${JSON.stringify(filePathConfigs.manifestFilePaths,null,2)}',`
+ `'helmChartPaths': '${JSON.stringify(filePathConfigs.helmChartFilePaths,null,2)}',`
+ `'provider': 'GitHub'`
+ `}`;
}

View File

@ -6,6 +6,7 @@ import { GitHubClient } from '../githubClient';
import { StatusCodes } from "./httpClient";
import * as exec from "./exec";
import * as inputParams from "../input-parameters";
import { Z_FILTERED } from 'zlib';
export function getExecutableExtension(): string {
if (os.type().match(/^Win/)) {
@ -140,8 +141,13 @@ export async function getFilePathsConfigs(): Promise<any> {
let inputManifestFiles = inputParams.manifests || [];
filePathsConfig[MANIFEST_PATHS_KEY] = inputManifestFiles;
let helmChartPaths = process.env.HELM_CHART_PATHS || '';
filePathsConfig[HELM_CHART_KEY] = helmChartPaths.split('\n');
let helmChartPaths = [];
if(process.env.HELM_CHART_PATHS){
helmChartPaths = process.env.HELM_CHART_PATHS.split('\n');
helmChartPaths.filter( val => val != "" );
}
filePathsConfig[HELM_CHART_KEY] = helmChartPaths;
//Fetch labels from each image