feat(catalog-backend-module-gitlab): Filter Gitlab archived projects through APIs

Signed-off-by: alessandro <alessandro.manno@facile.it>
This commit is contained in:
alessandro
2023-07-27 15:10:03 +02:00
parent f602c02daa
commit 2fe1f5973f
4 changed files with 8 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-gitlab': patch
---
Filter Gitlab archived projects through APIs
@@ -109,6 +109,7 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor {
const lastActivity = (await this.cache.get(this.getCacheKey())) as string;
const opts = {
archived: false,
group,
page: 1,
// We check for the existence of lastActivity and only set it if it's present to ensure
@@ -125,10 +126,6 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor {
for await (const project of projects) {
res.scanned++;
if (project.archived) {
continue;
}
if (branch === '*' && project.default_branch === undefined) {
continue;
}
@@ -30,6 +30,7 @@ export type CommonListOptions = {
};
interface ListProjectOptions extends CommonListOptions {
archived?: boolean;
group?: string;
}
@@ -155,6 +155,7 @@ export class GitlabDiscoveryEntityProvider implements EntityProvider {
const projects = paginated<GitLabProject>(
options => client.listProjects(options),
{
archived: false,
group: this.config.group,
page: 1,
per_page: 50,
@@ -173,10 +174,6 @@ export class GitlabDiscoveryEntityProvider implements EntityProvider {
res.scanned++;
if (project.archived) {
continue;
}
if (
this.config.skipForkedRepos &&
project.hasOwnProperty('forked_from_project')