File tree Expand file tree Collapse file tree 3 files changed +6
-41
lines changed Expand file tree Collapse file tree 3 files changed +6
-41
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ export async function annotateAndLabelResources(
143
143
const workflowFilePath = await getWorkflowFilePath ( githubToken )
144
144
145
145
const deploymentConfig = await getDeploymentConfig ( )
146
- const annotationKeyLabel = getWorkflowAnnotationKeyLabel ( workflowFilePath )
146
+ const annotationKeyLabel = getWorkflowAnnotationKeyLabel ( )
147
147
148
148
await annotateResources (
149
149
files ,
Original file line number Diff line number Diff line change 1
- import {
2
- cleanLabel ,
3
- prefixObjectKeys
4
- } from '../utilities/workflowAnnotationUtils'
1
+ import { cleanLabel } from '../utilities/workflowAnnotationUtils'
5
2
6
3
describe ( 'WorkflowAnnotationUtils' , ( ) => {
7
- describe ( 'prefixObjectKeys' , ( ) => {
8
- it ( 'should prefix an object with a given prefix' , ( ) => {
9
- const obj = {
10
- foo : 'bar' ,
11
- baz : 'qux'
12
- }
13
- const prefix = 'prefix.'
14
- const expected = {
15
- 'prefix.foo' : 'bar' ,
16
- 'prefix.baz' : 'qux'
17
- }
18
- expect ( prefixObjectKeys ( obj , prefix ) ) . toEqual ( expected )
19
- } )
20
- } )
21
-
22
4
describe ( 'cleanLabel' , ( ) => {
23
5
it ( 'should clean label' , ( ) => {
24
6
const alreadyClean = 'alreadyClean'
Original file line number Diff line number Diff line change 1
1
import { DeploymentConfig } from '../types/deploymentConfig'
2
2
3
- const ANNOTATION_PREFIX = 'actions.github.com/'
4
-
5
- export function prefixObjectKeys ( obj : any , prefix : string ) : any {
6
- return Object . keys ( obj ) . reduce ( ( newObj , key ) => {
7
- newObj [ prefix + key ] = obj [ key ]
8
- return newObj
9
- } , { } )
10
- }
3
+ const ANNOTATION_PREFIX = 'actions.github.com'
11
4
12
5
export function getWorkflowAnnotations (
13
6
lastSuccessRunSha : string ,
@@ -31,21 +24,11 @@ export function getWorkflowAnnotations(
31
24
helmChartPaths : deploymentConfig . helmChartFilePaths ,
32
25
provider : 'GitHub'
33
26
}
34
- const prefixedAnnotationObject = prefixObjectKeys (
35
- annotationObject ,
36
- ANNOTATION_PREFIX
37
- )
38
- return JSON . stringify ( prefixedAnnotationObject )
27
+ return JSON . stringify ( annotationObject )
39
28
}
40
29
41
- export function getWorkflowAnnotationKeyLabel (
42
- workflowFilePath : string
43
- ) : string {
44
- const hashKey = require ( 'crypto' )
45
- . createHash ( 'MD5' )
46
- . update ( `${ process . env . GITHUB_REPOSITORY } /${ workflowFilePath } ` )
47
- . digest ( 'hex' )
48
- return `githubWorkflow_${ hashKey } `
30
+ export function getWorkflowAnnotationKeyLabel ( ) : string {
31
+ return `${ ANNOTATION_PREFIX } /k8s-deploy`
49
32
}
50
33
51
34
/**
You can’t perform that action at this time.
0 commit comments