Projects in subgroups not shown in group Usage Quota page

Problem

When visiting the group Usage Quota page, the breakdown of consumption by project bar graph does not show projects that are in subgroups. Only projects directly descendants of the top-level namespace are being displayed. Data for this chart is from the GraphQL endpoint

The table of projects and overall CI Minutes seem to include those projects (data from these is taken from the controller)

Desired Outcome / solution

  • All graphs in the Group Usage Quota page show CI Minutes for all projects in the group and sub-groups.

Possible Technical Solutions

The GraphQL endpoint should be augmented to include sub-group data

Technical Details

In Ci::Minutes::ProjectMonthlyUsage#for_namespace_monthly_usage we only list projects directly part of a namespace_id. Instead we should use all its descendants.

Something like:

all_namespace_ids = namespace_monthly_usage.namespace.self_and_descendant_ids
where(
  date: namespace_monthly_usage.date,
  project: Ci::ProjectMirror.by_namespace_id(all_namespace_ids).select(:project_id)
)

Ensure that the fix works for both graphs CI minutes breakdown per project and Shared runners duration breakdown per project.

Edited by Fabio Pitino - PTO until Jan 1