mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-04-12 17:42:20 +08:00
JSON structure fixes
This commit is contained in:
parent
27085d52d5
commit
9458d67ac6
@ -26,23 +26,22 @@ exports.deploymentTypes = ['deployment', 'replicaset', 'daemonset', 'pod', 'stat
|
|||||||
exports.workloadTypes = ['deployment', 'replicaset', 'daemonset', 'pod', 'statefulset', 'job', 'cronjob'];
|
exports.workloadTypes = ['deployment', 'replicaset', 'daemonset', 'pod', 'statefulset', 'job', 'cronjob'];
|
||||||
exports.workloadTypesWithRolloutStatus = ['deployment', 'daemonset', 'statefulset'];
|
exports.workloadTypesWithRolloutStatus = ['deployment', 'daemonset', 'statefulset'];
|
||||||
function getWorkflowAnnotationsJson(lastSuccessRunSha, workflowFilePath, filePathConfigs) {
|
function getWorkflowAnnotationsJson(lastSuccessRunSha, workflowFilePath, filePathConfigs) {
|
||||||
return `{`
|
let annotationObject;
|
||||||
+ `'run': '${process.env.GITHUB_RUN_ID}',`
|
annotationObject["run"] = process.env.GITHUB_RUN_ID;
|
||||||
+ `'repository': '${process.env.GITHUB_REPOSITORY}',`
|
annotationObject["repository"] = process.env.GITHUB_REPOSITORY;
|
||||||
+ `'workflow': '${process.env.GITHUB_WORKFLOW}',`
|
annotationObject["workflow"] = process.env.GITHUB_WORKFLOW;
|
||||||
+ `'workflowFileName': '${workflowFilePath.replace(".github/workflows/", "")}',`
|
annotationObject["workflowFileName"] = workflowFilePath.replace(".github/workflows/", "");
|
||||||
+ `'jobName': '${process.env.GITHUB_JOB}',`
|
annotationObject["jobName"] = process.env.GITHUB_JOB;
|
||||||
+ `'createdBy': '${process.env.GITHUB_ACTOR}',`
|
annotationObject["createdBy"] = process.env.GITHUB_ACTOR;
|
||||||
+ `'runUri': 'https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}',`
|
annotationObject["runUri"] = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
|
||||||
+ `'commit': '${process.env.GITHUB_SHA}',`
|
annotationObject["commit"] = process.env.GITHUB_SHA;
|
||||||
+ `'lastSuccessRunCommit': '${lastSuccessRunSha}',`
|
annotationObject["branch"] = process.env.GITHUB_REF;
|
||||||
+ `'branch': '${process.env.GITHUB_REF}',`
|
annotationObject["deployTimestamp"] = Date.now();
|
||||||
+ `'deployTimestamp': '${Date.now()}',`
|
annotationObject["dockerfilePaths"] = filePathConfigs.dockerfilePaths;
|
||||||
+ `'dockerfilePaths': '${JSON.stringify(filePathConfigs.dockerfilePaths, null, 2)}',`
|
annotationObject["manifestsPaths"] = filePathConfigs.manifestFilePaths;
|
||||||
+ `'manifestsPaths': '${JSON.stringify(filePathConfigs.manifestFilePaths, null, 2)}',`
|
annotationObject["helmChartPaths"] = filePathConfigs.helmChartFilePaths;
|
||||||
+ `'helmChartPaths': '${JSON.stringify(filePathConfigs.helmChartFilePaths, null, 2)}',`
|
annotationObject["provider"] = "GitHub";
|
||||||
+ `'provider': 'GitHub'`
|
return JSON.stringify(annotationObject);
|
||||||
+ `}`;
|
|
||||||
}
|
}
|
||||||
exports.getWorkflowAnnotationsJson = getWorkflowAnnotationsJson;
|
exports.getWorkflowAnnotationsJson = getWorkflowAnnotationsJson;
|
||||||
function getWorkflowAnnotationKeyLabel(workflowFilePath) {
|
function getWorkflowAnnotationKeyLabel(workflowFilePath) {
|
||||||
|
|||||||
@ -151,7 +151,7 @@ function getFilePathsConfigs() {
|
|||||||
let helmChartPaths = [];
|
let helmChartPaths = [];
|
||||||
if (process.env.HELM_CHART_PATHS) {
|
if (process.env.HELM_CHART_PATHS) {
|
||||||
helmChartPaths = process.env.HELM_CHART_PATHS.split('\n');
|
helmChartPaths = process.env.HELM_CHART_PATHS.split('\n');
|
||||||
helmChartPaths.filter(val => val != "");
|
helmChartPaths.splice(-1);
|
||||||
}
|
}
|
||||||
filePathsConfig[HELM_CHART_KEY] = helmChartPaths;
|
filePathsConfig[HELM_CHART_KEY] = helmChartPaths;
|
||||||
//Fetch labels from each image
|
//Fetch labels from each image
|
||||||
|
|||||||
@ -26,23 +26,23 @@ export const workloadTypes: string[] = ['deployment', 'replicaset', 'daemonset',
|
|||||||
export const workloadTypesWithRolloutStatus: string[] = ['deployment', 'daemonset', 'statefulset'];
|
export const workloadTypesWithRolloutStatus: string[] = ['deployment', 'daemonset', 'statefulset'];
|
||||||
|
|
||||||
export function getWorkflowAnnotationsJson(lastSuccessRunSha: string, workflowFilePath: string, filePathConfigs: any): string {
|
export function getWorkflowAnnotationsJson(lastSuccessRunSha: string, workflowFilePath: string, filePathConfigs: any): string {
|
||||||
return `{`
|
let annotationObject: any;
|
||||||
+ `'run': '${process.env.GITHUB_RUN_ID}',`
|
annotationObject["run"] = process.env.GITHUB_RUN_ID;
|
||||||
+ `'repository': '${process.env.GITHUB_REPOSITORY}',`
|
annotationObject["repository"] = process.env.GITHUB_REPOSITORY;
|
||||||
+ `'workflow': '${process.env.GITHUB_WORKFLOW}',`
|
annotationObject["workflow"] = process.env.GITHUB_WORKFLOW;
|
||||||
+ `'workflowFileName': '${workflowFilePath.replace(".github/workflows/", "")}',`
|
annotationObject["workflowFileName"] = workflowFilePath.replace(".github/workflows/", "");
|
||||||
+ `'jobName': '${process.env.GITHUB_JOB}',`
|
annotationObject["jobName"] = process.env.GITHUB_JOB;
|
||||||
+ `'createdBy': '${process.env.GITHUB_ACTOR}',`
|
annotationObject["createdBy"] = process.env.GITHUB_ACTOR;
|
||||||
+ `'runUri': 'https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}',`
|
annotationObject["runUri"] = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
|
||||||
+ `'commit': '${process.env.GITHUB_SHA}',`
|
annotationObject["commit"] = process.env.GITHUB_SHA;
|
||||||
+ `'lastSuccessRunCommit': '${lastSuccessRunSha}',`
|
annotationObject["branch"] = process.env.GITHUB_REF;
|
||||||
+ `'branch': '${process.env.GITHUB_REF}',`
|
annotationObject["deployTimestamp"] = Date.now();
|
||||||
+ `'deployTimestamp': '${Date.now()}',`
|
annotationObject["dockerfilePaths"] = filePathConfigs.dockerfilePaths;
|
||||||
+ `'dockerfilePaths': '${JSON.stringify(filePathConfigs.dockerfilePaths,null,2)}',`
|
annotationObject["manifestsPaths"] = filePathConfigs.manifestFilePaths
|
||||||
+ `'manifestsPaths': '${JSON.stringify(filePathConfigs.manifestFilePaths,null,2)}',`
|
annotationObject["helmChartPaths"] = filePathConfigs.helmChartFilePaths;
|
||||||
+ `'helmChartPaths': '${JSON.stringify(filePathConfigs.helmChartFilePaths,null,2)}',`
|
annotationObject["provider"] = "GitHub";
|
||||||
+ `'provider': 'GitHub'`
|
|
||||||
+ `}`;
|
return JSON.stringify(annotationObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getWorkflowAnnotationKeyLabel(workflowFilePath: string): string {
|
export function getWorkflowAnnotationKeyLabel(workflowFilePath: string): string {
|
||||||
|
|||||||
@ -144,7 +144,7 @@ export async function getFilePathsConfigs(): Promise<any> {
|
|||||||
let helmChartPaths = [];
|
let helmChartPaths = [];
|
||||||
if(process.env.HELM_CHART_PATHS){
|
if(process.env.HELM_CHART_PATHS){
|
||||||
helmChartPaths = process.env.HELM_CHART_PATHS.split('\n');
|
helmChartPaths = process.env.HELM_CHART_PATHS.split('\n');
|
||||||
helmChartPaths.filter( val => val != "" );
|
helmChartPaths.splice(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
filePathsConfig[HELM_CHART_KEY] = helmChartPaths;
|
filePathsConfig[HELM_CHART_KEY] = helmChartPaths;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user