backstage icon indicating copy to clipboard operation
backstage copied to clipboard

🚀 Feature: Add possibility to discover archived projects with `catalog-backend-module-gitlab`

Open mkaliszewski opened this issue 1 year ago • 2 comments

🔖 Feature description

I'd love to have a possibility to discover archived projects as well as the active ones. I think it should work analogically to skipArchivedRepos in Bitbucket Server Discovery.

🎤 Context

This feature should be implemented, as there is currently no control over discovering archived projects. This would be helpful for organizational purposes, allowing you to see which elements are no longer in use (for example, by editing the entity with a custom postProcessEntity implementation).

✌️ Possible Implementation

  1. Extend GitlabProviderConfig type in plugins/catalog-backend-module-gitlab/src/lib/types.ts
  2. Add true as the default value if property missing in config - plugins/catalog-backend-module-gitlab/src/lib/types.ts
  3. Update the refresh method in plugins/catalog-backend-module-gitlab/src/providers/GitlabDiscoveryEntityProvider.ts from:
    const projects = paginated<GitLabProject>(options => this.gitLabClient.listProjects(options), {
      archived: false,
      group: this.config.group,
      page: 1,
      per_page: 50,
    });

to:

    const projects = paginated<GitLabProject>(options => this.gitLabClient.listProjects(options), {
     ...(this.config.skipArchivedRepos && { archived: false }),
     group: this.config.group,
     page: 1,
     per_page: 50,
   });

👀 Have you spent some time to check if this feature request has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

### Tasks

mkaliszewski avatar Oct 16 '24 12:10 mkaliszewski

Yep, sounds good, please go ahead! 👍

I think we want to keep archived repos excluded by default, so the actual config should probably be something like includeArchivedRepos: true, just because it's more intuitive to have the default value be false.

Rugvip avatar Oct 17 '24 10:10 Rugvip

@Rugvip thanks for your comment! I just created a PR -> https://github.com/backstage/backstage/pull/27245.

mkaliszewski avatar Oct 18 '24 09:10 mkaliszewski

This is already implemented and released.

mkaliszewski avatar Nov 22 '24 10:11 mkaliszewski