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:

  • CiCatalogResourceProjectUsage and CiCatalogResourceComponentUsageDetail GraphQL types (hash-backed)
  • ComponentUsagesResolver with authorization (maintainer+), license check, feature flag gating, and project visibility filtering
  • EE extension on CiCatalogResourceType with componentUsages connection field
  • ci_component_analytics feature flag (gitlab_com_derisk, disabled by default, project actor-based)
  • CE prepend_mod_with for 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_versions scope
  • !226460 (merged) — Add componentUsages GraphQL types, feature flag, and connection type (merged into this branch)

How to set up and validate locally

  1. Enable the feature flag:
    Feature.enable(:ci_component_analytics)
  2. 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

Merge request reports

Loading