From 9ef5a126d5531defe8b0e8bc08828491b30ed889 Mon Sep 17 00:00:00 2001 From: Andrew Thauer Date: Tue, 9 Mar 2021 09:12:03 -0500 Subject: [PATCH] feat(catalog-backend): support more codeownerprocessor kinds Signed-off-by: Andrew Thauer --- .changeset/bright-spiders-sniff.md | 5 +++++ .../src/ingestion/processors/CodeOwnersProcessor.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/bright-spiders-sniff.md diff --git a/.changeset/bright-spiders-sniff.md b/.changeset/bright-spiders-sniff.md new file mode 100644 index 0000000000..42f47d5408 --- /dev/null +++ b/.changeset/bright-spiders-sniff.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Allow CodeOwnersProcessor to set spec.owner for System and Resource entity kinds. diff --git a/plugins/catalog-backend/src/ingestion/processors/CodeOwnersProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/CodeOwnersProcessor.ts index 8a3951428e..2f432f4a0f 100644 --- a/plugins/catalog-backend/src/ingestion/processors/CodeOwnersProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/CodeOwnersProcessor.ts @@ -29,6 +29,8 @@ import { filter, get, head, pipe, reverse } from 'lodash/fp'; import { Logger } from 'winston'; import { CatalogProcessor } from './types'; +const ALLOWED_KINDS = ['API', 'Component', 'Resource', 'System']; + const ALLOWED_LOCATION_TYPES = [ 'url', 'azure/api', @@ -59,7 +61,7 @@ export class CodeOwnersProcessor implements CatalogProcessor { // Only continue if the owner is not set if ( !entity || - !['Component', 'API'].includes(entity.kind) || + !ALLOWED_KINDS.includes(entity.kind) || !ALLOWED_LOCATION_TYPES.includes(location.type) || (entity.spec && entity.spec.owner) ) {