Add Component usage details in GraphQL
What does this MR do and why?
Adds a componentUsages GraphQL field to CiCatalogResource that shows which projects use components from a catalog resource, including version, last used date, and whether the version is outdated. This enables the Component Usage Details page for CI Catalog resources.
Changes included:
-
CiCatalogResourceProjectUsageandCiCatalogResourceComponentUsageDetailGraphQL types (hash-backed) -
ComponentUsagesResolverwith authorization (maintainer+), license check, feature flag gating, and project visibility filtering - EE extension on
CiCatalogResourceTypewithcomponentUsagesconnection field -
ci_component_analyticsfeature flag (gitlab_com_derisk, disabled by default, project actor-based) - CE
prepend_mod_withfor the EE extension - Unit specs for all types and resolver
- Integration (request) spec covering the full GraphQL stack with N+1 query check
Previous MRs
-
!222665 (merged) — Add semver fields to
CiCatalogResourceVersion -
!224045 (merged) — Add
for_catalog_resource_with_component_versionsscope -
!226460 (merged) — Add
componentUsagesGraphQL types, feature flag, and connection type (merged into this branch)
How to set up and validate locally
- Enable the feature flag:
Feature.enable(:ci_component_analytics) - Query the GraphQL API as a maintainer of a catalog resource project:
query { ciCatalogResource(fullPath: "<project-path>") { componentUsages { nodes { project { fullPath } componentsUsed { component { name } version { name } lastUsedDate outdated } } } } }
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.
Related to #579460
Edited by Rajendra Kadam