in src/utilities/manifestUpdateUtils.ts [270:304]
export function getResources(
filePaths: string[],
filterResourceTypes: string[]
): Resource[] {
if (!filePaths) return []
const resources: Resource[] = []
filePaths.forEach((filePath: string) => {
try {
const fileContents = fs.readFileSync(filePath).toString()
const inputObjects: K8sObject[] = yaml.loadAll(
fileContents
) as K8sObject[]
inputObjects.forEach((inputObject) => {
const inputObjectKind = inputObject?.kind || ''
if (
filterResourceTypes.filter(
(type) => inputObjectKind.toLowerCase() === type.toLowerCase()
).length > 0
) {
resources.push({
type: inputObject.kind,
name: inputObject.metadata.name,
namespace: inputObject?.metadata?.namespace
})
}
})
} catch (error) {
core.error(`Failed to process file at ${filePath}: ${error.message}`)
throw error
}
})
return resources
}