feat(gerrit): support glob discovery #28387
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thesearch
method. This search, just like theGithubUrlReader
downloads the tree of the repository using Gitiles API. It then iterates and filters the result usingminimatch
.For this to work I also needed to change how the
UrlReaderProcessor
detects wildcards, since Gerrit Gitiles URLs are not parsed by thegit-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
Screenshots attached (for UI changes)Signed-off-by
line in the message. (more info)