feat/catalog-backend-module-gitlab: create url location only if file exists (fixes #2)

Signed-off-by: Ruslan.Nasyrov <goququ@ya.ru>
This commit is contained in:
Ruslan.Nasyrov
2022-05-17 13:43:00 +05:00
parent ba95c81bff
commit cf864e9e25
3 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -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
+4 -1
View File
@@ -47,6 +47,9 @@ of your backend.
): Promise<Router> {
const builder = await CatalogBuilder.create(env);
+ builder.addProcessor(
+ GitLabDiscoveryProcessor.fromConfig(env.config, { logger: env.logger })
+ GitLabDiscoveryProcessor.fromConfig(env.config, {
+ logger: env.logger,
+ skipReposWithoutExactFileMatch: true,
+ })
+ );
```
@@ -16,6 +16,7 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor {
config: Config,
options: {
logger: Logger;
skipReposWithoutExactFileMatch?: boolean;
},
): GitLabDiscoveryProcessor;
// (undocumented)