Skip to content

PipelinesUsageApp: add project list and their CI usage

What does this MR do and why?

Relates to: https://gitlab.com/gitlab-org/gitlab/-/issues/345373

As part of the bigger effort to have a common layout for Usage Quotas we need to migrate the pipelines tab to vue. This MR is the next in line after !83021 (merged)

For this MR we add the project list to the PipelinesUsageApp:

  • Add GraphQL queries (getNamespaceProjectsInfo to fetch projects details, and getCiMinutesUsageNamespace to get ci minute usage per project and later will be used to populate the graph above)
  • Add loading and error states

Screenshots or screen recordings

Namespace with projects

Before After
usage_quotas_pipelines_tab_before usage_quotas_project_list_after

To add some data:

  • Ci::Minutes::ProjectMonthlyUsage.where(project_id: <project id here>, date: Date.new(2022, 04, 01), amount_used: 100).save
  • The date here needs to be the first day of the current month in order to appear in the project list

Namespace without projects

Here there was a bug where the wrong message was shown, we're fixing this in this MR too

Before After
project_list_namespace_no_projects_before project_list_namespace_no_projects_after

Namespace with projects with shared runner disabled

  • For all projects of the namespace: Project.find(<project id here>).update(shared_runners_enabled: false)
    • We need this call to return false: Project.with_shared_runners.in_namespace(Group.find(<group id here>)).any?
Before After
project_list_shared_runners_disabled_before project_list_shared_runners_disabled_after

How to set up and validate locally

  1. Apply this patch to inject PipelinesUsageApp in the Usage Quotas page: pipelines-vue-patch.patch
    1. Download the file then git apply ~/path/to/file/pipelines-vue-patch.patch
  2. Navigate to the Usage Quotas page, e.g.: http://gdk.test:3000/groups/flightjs/-/usage_quotas#pipelines-quota-tab
  3. Check that the project list is loading fine

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sheldon Led

Merge request reports