From cf864e9e25489b5cdad46ab7849c68d67eff8a9f Mon Sep 17 00:00:00 2001 From: "Ruslan.Nasyrov" Date: Tue, 17 May 2022 13:43:00 +0500 Subject: [PATCH] feat/catalog-backend-module-gitlab: create url location only if file exists (fixes #2) Signed-off-by: Ruslan.Nasyrov --- .changeset/real-beers-type.md | 4 ++-- docs/integrations/gitlab/discovery.md | 5 ++++- plugins/catalog-backend-module-gitlab/api-report.md | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.changeset/real-beers-type.md b/.changeset/real-beers-type.md index e3ab67cfca..f09aafe007 100644 --- a/.changeset/real-beers-type.md +++ b/.changeset/real-beers-type.md @@ -2,7 +2,7 @@ '@backstage/plugin-catalog-backend-module-gitlab': patch --- -do not create url location object if file with component definition do not exists in project, that decrease count of request to gitlab with 404 status code. Now we can create processor with new flag to enable this logic: +do not create location object if file with component definition do not exists in project, that decrease count of request to gitlab with 404 status code. Now we can create processor with new flag to enable this logic: ```ts const processor = GitLabDiscoveryProcessor.fromConfig(config, { @@ -11,4 +11,4 @@ const processor = GitLabDiscoveryProcessor.fromConfig(config, { }); ``` -**WARNING:** This new functionality does not support globs in the repo filepath +**WARNING:** This new functionality does not support globs in the repo file path diff --git a/docs/integrations/gitlab/discovery.md b/docs/integrations/gitlab/discovery.md index 8d805fa362..2ce4b59ca6 100644 --- a/docs/integrations/gitlab/discovery.md +++ b/docs/integrations/gitlab/discovery.md @@ -47,6 +47,9 @@ of your backend. ): Promise { const builder = await CatalogBuilder.create(env); + builder.addProcessor( -+ GitLabDiscoveryProcessor.fromConfig(env.config, { logger: env.logger }) ++ GitLabDiscoveryProcessor.fromConfig(env.config, { ++ logger: env.logger, ++ skipReposWithoutExactFileMatch: true, ++ }) + ); ``` diff --git a/plugins/catalog-backend-module-gitlab/api-report.md b/plugins/catalog-backend-module-gitlab/api-report.md index ec10f80939..63e6fe7ccb 100644 --- a/plugins/catalog-backend-module-gitlab/api-report.md +++ b/plugins/catalog-backend-module-gitlab/api-report.md @@ -16,6 +16,7 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor { config: Config, options: { logger: Logger; + skipReposWithoutExactFileMatch?: boolean; }, ): GitLabDiscoveryProcessor; // (undocumented)