Skip to content

Conversation

tcardonne
Copy link
Contributor

Hey, I just made a Pull Request!

This PR adds support for wildcards in the Gerrit discovery configuration:

catalog:
  providers:
    gerrit:
      all:
        host: gerrit.company.com
        query: 'state=ACTIVE&type=CODE'
+       catalogPath: '**/catalog-info.{yml,yaml}'

To support this, the GerritUrlReader now implements the search method. This search, just like the GithubUrlReader downloads the tree of the repository using Gitiles API. It then iterates and filters the result using minimatch.

For this to work I also needed to change how the UrlReaderProcessor detects wildcards, since Gerrit Gitiles URLs are not parsed by the git-url-parse library.
I found a similar attempt that has been rollbacked with #22502. I believe that matching wildcards in the URL's path or in the querystring should work (to support Azure DevOps pattern).

Also for testing purposes I re-enabled the tests disabled in #20077 (95dab58). Let me know if you want to keep those skipped.

This was tested locally using our Gerrit instance and it allows to find all Backstage catalog manifests in our 500+ repositories including one monorepo with ~800 catalog files. It takes less than one minute to ingest all of these 🚀

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

tcardonne and others added 6 commits January 7, 2025 14:53
Signed-off-by: Thomas Cardonne <thomas.cardonne@adevinta.com>
Signed-off-by: Thomas Cardonne <thomas.cardonne@adevinta.com>
Signed-off-by: Thomas Cardonne <thomas.cardonne@adevinta.com>
Co-authored-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Signed-off-by: Thomas Cardonne <t.cardonne@gmail.com>
…lReader.ts

Co-authored-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Signed-off-by: Thomas Cardonne <t.cardonne@gmail.com>
Signed-off-by: Thomas Cardonne <thomas.cardonne@adevinta.com>
@github-actions github-actions bot added area:documentation Improvements or additions to documentation area:catalog Related to the Catalog Project Area labels Jan 7, 2025
@backstage-goalie
Copy link
Contributor

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage/backend-defaults packages/backend-defaults patch v0.7.0-next.0
@backstage/integration packages/integration minor v1.16.0
@backstage/plugin-catalog-backend-module-gerrit plugins/catalog-backend-module-gerrit minor v0.2.6-next.0
@backstage/plugin-catalog-backend plugins/catalog-backend patch v1.30.0-next.0

Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:catalog Related to the Catalog Project Area area:documentation Improvements or additions to documentation stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant