Loading
Add search argument to CI Catalog versions GraphQL resolver
What does this MR do and why?
Adds a search argument to the VersionsResolver for CI Catalog resources, enabling filtering of versions by name through the GraphQL API.
References
Related to #419114 (closed)
How to set up and validate locally
- Create a catalog resource with multiple versions by creating releases with different tags (e.g.,
1.0.0,1.1.0,2.0.0). See CI/CD Catalog documentation for details. - Query versions using the search argument:
query {
ciCatalogResource(fullPath: "your-project-path") {
versions(search: "1.0") {
nodes {
name
}
}
}
}- Verify that only versions matching the search term are returned
Database
New query: search versions by semver
ActiveRecord:
Ci::Catalog::Resources::Version
.for_catalog_resources(catalog_resource)
.search_by_version("1.0")Raw SQL:
SELECT "catalog_resource_versions".*
FROM "catalog_resource_versions"
WHERE "catalog_resource_versions"."catalog_resource_id" = 1000655
AND (concat_ws('.', semver_major, semver_minor, semver_patch)
|| COALESCE('-' || semver_prerelease, '') ILIKE '%1.0%')
LIMIT 20 OFFSET 0Query plan: postgres.ai
- Execution time: 14ms
- Uses index scan on
index_catalog_resource_versions_on_resource_id_and_released_at - ILIKE applied as post-filter after index narrows by
catalog_resource_id - No new indexes required; the existing index on
(catalog_resource_id, released_at)is sufficient since the number of versions per catalog resource is small
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Anna Vovchenko