Skip to content

Commit c289379

Browse files
committed
fix: load workload values
1 parent 50a3c6e commit c289379

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/repo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ export async function loadFileToSpec(
473473
): Promise<void> {
474474
const jsonPath = getJsonPath(fileMap, filePath)
475475
try {
476-
const data = (await deps.loadYaml(filePath)) || {}
476+
const data = (await deps.loadYaml(filePath, { isRaw: fileMap.kind === 'AplTeamWorkloadValues' })) || {}
477477
// ensure that local path does not include envDir and the leading slash
478478
const localFilePath = filePath.replace(fileMap.envDir, '').replace(/^\/+/, '')
479479
// eslint-disable-next-line no-param-reassign

src/utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,17 @@ export const flattenObject = (
6565
}, {})
6666
}
6767

68-
export const loadYaml = async (path: string, opts?: { noError: boolean }): Promise<Record<string, any> | undefined> => {
68+
export const loadYaml = async (
69+
path: string,
70+
opts?: { noError?: boolean; isRaw?: boolean },
71+
): Promise<Record<string, any> | undefined> => {
6972
if (!(await pathExists(path))) {
7073
if (opts?.noError) return undefined
7174
throw new Error(`${path} does not exist`)
7275
}
73-
return parse(await readFile(path, 'utf-8')) as Record<string, any>
76+
const rawFile = await readFile(path, 'utf-8')
77+
if (opts?.isRaw) return rawFile as any
78+
return parse(rawFile) as Record<string, any>
7479
}
7580

7681
const valuesSchemaEndpointUrl = `${BASEURL}/apl/schema`

0 commit comments

Comments
 (0)