Removed success run API and edited testcases.

This commit is contained in:
Koushik Dey
2020-08-10 20:07:46 +05:30
parent 3d1e46f18f
commit 3a1c0b10eb
7 changed files with 81 additions and 110 deletions
@@ -133,7 +133,11 @@ function annotateResources(files, kubectl, resourceTypes, allPods, annotationKey
utility_1.checkForErrors(annotateResults, true);
}
function labelResources(files, kubectl, label) {
utility_1.checkForErrors([kubectl.labelFiles(files, [`workflow=${label}`], true)], true);
let workflowName = process.env.GITHUB_WORKFLOW;
workflowName = workflowName.startsWith('.github/workflows/') ?
workflowName.replace(".github/workflows/", "") : workflowName;
const labels = [`workflowFriendlyName=${workflowName}`, `workflow=${label}`];
utility_1.checkForErrors([kubectl.labelFiles(files, labels, true)], true);
}
function updateResourceObjects(filePaths, imagePullSecrets, containers) {
const newObjectsList = [];
+3 -3
View File
@@ -67,13 +67,13 @@ function getLastSuccessfulRunSha(kubectl, namespaceName, annotationKey) {
return '';
}
else {
if (result.stderr) {
if (!!result.stderr) {
core.debug(`${result.stderr}`);
return process.env.GITHUB_SHA;
}
else if (result.stdout) {
else if (!!result.stdout) {
const annotationsSet = JSON.parse(result.stdout).metadata.annotations;
if (!!annotationsSet[annotationKey]) {
if (!!annotationsSet && !!annotationsSet[annotationKey]) {
return JSON.parse(annotationsSet[annotationKey].replace(/'/g, '"')).commit;
}
else {