diff --git a/.changeset/cyan-guests-burn.md b/.changeset/cyan-guests-burn.md new file mode 100644 index 0000000000..78f2bb535d --- /dev/null +++ b/.changeset/cyan-guests-burn.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Resolve the `target` for glob `file` locations correctly diff --git a/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.test.ts b/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.test.ts index 0155f93916..d51f22f538 100644 --- a/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.test.ts @@ -79,6 +79,14 @@ describe('FileReaderProcessor', () => { expect(emit).toBeCalledTimes(2); expect(emit.mock.calls[0][0].entity).toEqual({ kind: 'Component' }); + expect(emit.mock.calls[0][0].location).toEqual({ + type: 'file', + target: expect.stringMatching(/^[^*]*$/), + }); expect(emit.mock.calls[1][0].entity).toEqual({ kind: 'API' }); + expect(emit.mock.calls[1][0].location).toEqual({ + type: 'file', + target: expect.stringMatching(/^[^*]*$/), + }); }); }); diff --git a/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.ts index db069913a2..d92751a24b 100644 --- a/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.ts @@ -41,7 +41,10 @@ export class FileReaderProcessor implements CatalogProcessor { for (const fileMatch of fileMatches) { const data = await fs.readFile(fileMatch); - for (const parseResult of parseEntityYaml(data, location)) { + for (const parseResult of parseEntityYaml(data, { + type: 'file', + target: fileMatch, + })) { emit(parseResult); } }