Merge pull request #4737 from nirga/optional-repo

Made all locations outputted by GithubDiscoveryProcessor optional
This commit is contained in:
Fredrik Adelöw
2021-03-01 09:31:06 +01:00
committed by GitHub
3 changed files with 14 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
GithubDiscoveryProcessor outputs locations as optional to avoid outputting errors for missing locations (see https://github.com/backstage/backstage/issues/4730).
@@ -133,7 +133,7 @@ describe('GithubDiscoveryProcessor', () => {
target:
'https://github.com/backstage/backstage/blob/master/catalog.yaml',
},
optional: false,
optional: true,
});
expect(emitter).toHaveBeenCalledWith({
type: 'location',
@@ -141,7 +141,7 @@ describe('GithubDiscoveryProcessor', () => {
type: 'url',
target: 'https://github.com/backstage/demo/blob/master/catalog.yaml',
},
optional: false,
optional: true,
});
});
@@ -175,7 +175,7 @@ describe('GithubDiscoveryProcessor', () => {
target:
'https://github.com/backstage/techdocs-cli/blob/master/catalog.yaml',
},
optional: false,
optional: true,
});
expect(emitter).toHaveBeenCalledWith({
type: 'location',
@@ -184,7 +184,7 @@ describe('GithubDiscoveryProcessor', () => {
target:
'https://github.com/backstage/techdocs-container/blob/master/catalog.yaml',
},
optional: false,
optional: true,
});
});
it('filter unrelated repositories', async () => {
@@ -215,7 +215,7 @@ describe('GithubDiscoveryProcessor', () => {
type: 'url',
target: 'https://github.com/backstage/test/blob/master/catalog.yaml',
},
optional: false,
optional: true,
});
});
});
@@ -94,7 +94,10 @@ export class GithubDiscoveryProcessor implements CatalogProcessor {
type: 'url',
target: `${repository.url}${catalogPath}`,
},
false,
// Not all locations may actually exist, since the user defined them as a wildcard pattern.
// Thus, we emit them as optional and let the downstream processor find them while not outputting
// an error if it couldn't.
true,
),
);
}