Skip to content

Commit 892a009

Browse files
fix: only add label for teamresources (#2792)
Co-authored-by: svcAPLBot <[email protected]>
1 parent dee2fdc commit 892a009

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/common/repo.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ export interface FileMap {
5252
loadToSpec: boolean
5353
}
5454

55+
export interface AplManifest {
56+
kind: AplKind
57+
metadata: {
58+
name: string
59+
labels?: Record<string, string>
60+
}
61+
spec: Record<string, any>
62+
}
63+
5564
export function getResourceFileName(fileMap: FileMap, jsonPath: jsonpath.PathComponent[], data: Record<string, any>) {
5665
let fileName = 'unknown'
5766
if (fileMap.resourceGroup === 'team') {
@@ -409,22 +418,27 @@ export async function saveValues(
409418
)
410419
}
411420

412-
export function renderManifest(fileMap: FileMap, jsonPath: jsonpath.PathComponent[], data: Record<string, any>) {
421+
export function renderManifest(
422+
fileMap: FileMap,
423+
jsonPath: jsonpath.PathComponent[],
424+
data: Record<string, any>,
425+
): AplManifest {
413426
//TODO remove this custom workaround for workloadValues
414427
let spec = data
415428
if (fileMap.resourceGroup === 'team') {
416429
spec = omit(data, ['id', 'name', 'teamId'])
417430
}
418-
const manifest = {
431+
const manifest: AplManifest = {
419432
kind: fileMap.kind,
420433
metadata: {
421434
name: getResourceName(fileMap, jsonPath, data),
422-
labels: {},
423435
},
424436
spec,
425437
}
426438
if (fileMap.resourceGroup === 'team') {
427-
manifest.metadata.labels['apl.io/teamId'] = getTeamNameFromJsonPath(jsonPath)
439+
manifest.metadata.labels = {
440+
'apl.io/teamId': getTeamNameFromJsonPath(jsonPath),
441+
}
428442
}
429443

430444
return manifest

0 commit comments

Comments
 (0)