Compare commits

..

7 Commits

Author SHA1 Message Date
Vidya Reddy 6b03d40a74 revert the docker changes 2022-07-28 19:48:37 +05:30
Vidya Reddy e456a366fc Fixes for docker with no image 2022-07-28 19:36:14 +05:30
Vidya Reddy c97519147a updated the annotation prefix 2022-07-27 22:35:03 +05:30
Vidya Reddy 1516e1430d updated the annotation key label 2022-07-27 22:23:32 +05:30
Vidya Reddy 0a3b59b275 add annotation key prefix 2022-07-27 14:38:28 +05:30
Vidya Reddy d96b9b2965 add annotation key prefix 2022-07-27 14:33:12 +05:30
Vidya Reddy 71e93a71d4 Added Traffic split annotations (#215)
* Added Traffic split annotations

* traffic split - blueGreen deployment

* traffic split - canary deployment

* Traffic split annotations - canary deployment

* updated Readme and action.yml

* Traffic split - canary deployment

* clean code

* Clean code

* Clean code

* Create annotation object

* Updated Readme and action.yml

* Spelling correction

Co-authored-by: Vidya Reddy <vidyareddy@microsoft.com>
2022-07-25 13:43:13 -04:00
3 changed files with 6 additions and 41 deletions
+1 -1
View File
@@ -143,7 +143,7 @@ export async function annotateAndLabelResources(
const workflowFilePath = await getWorkflowFilePath(githubToken)
const deploymentConfig = await getDeploymentConfig()
const annotationKeyLabel = getWorkflowAnnotationKeyLabel(workflowFilePath)
const annotationKeyLabel = getWorkflowAnnotationKeyLabel()
await annotateResources(
files,
+1 -19
View File
@@ -1,24 +1,6 @@
import {
cleanLabel,
prefixObjectKeys
} from '../utilities/workflowAnnotationUtils'
import {cleanLabel} from '../utilities/workflowAnnotationUtils'
describe('WorkflowAnnotationUtils', () => {
describe('prefixObjectKeys', () => {
it('should prefix an object with a given prefix', () => {
const obj = {
foo: 'bar',
baz: 'qux'
}
const prefix = 'prefix.'
const expected = {
'prefix.foo': 'bar',
'prefix.baz': 'qux'
}
expect(prefixObjectKeys(obj, prefix)).toEqual(expected)
})
})
describe('cleanLabel', () => {
it('should clean label', () => {
const alreadyClean = 'alreadyClean'
+4 -21
View File
@@ -1,13 +1,6 @@
import {DeploymentConfig} from '../types/deploymentConfig'
const ANNOTATION_PREFIX = 'actions.github.com/'
export function prefixObjectKeys(obj: any, prefix: string): any {
return Object.keys(obj).reduce((newObj, key) => {
newObj[prefix + key] = obj[key]
return newObj
}, {})
}
const ANNOTATION_PREFIX = 'actions.github.com'
export function getWorkflowAnnotations(
lastSuccessRunSha: string,
@@ -31,21 +24,11 @@ export function getWorkflowAnnotations(
helmChartPaths: deploymentConfig.helmChartFilePaths,
provider: 'GitHub'
}
const prefixedAnnotationObject = prefixObjectKeys(
annotationObject,
ANNOTATION_PREFIX
)
return JSON.stringify(prefixedAnnotationObject)
return JSON.stringify(annotationObject)
}
export function getWorkflowAnnotationKeyLabel(
workflowFilePath: string
): string {
const hashKey = require('crypto')
.createHash('MD5')
.update(`${process.env.GITHUB_REPOSITORY}/${workflowFilePath}`)
.digest('hex')
return `githubWorkflow_${hashKey}`
export function getWorkflowAnnotationKeyLabel(): string {
return `${ANNOTATION_PREFIX}/k8s-deploy`
}
/**