feat(catalog-backend-module-gitlab): Filter Gitlab archived projects through APIs
Signed-off-by: alessandro <alessandro.manno@facile.it>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user