Skip to content

GraphQL: Implement fullPath in RunnersExportUsage mutation

What does this MR do and why?

This MR follows up on !154300 (merged) and !139158 (merged) to allow the user to export a CSV of runner usage for runners executing jobs for projects within a group, or for a single project.

EE: true

Closes #440607 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

scenario screenshot
mail image image
CSV image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Ensure you have an Ultimate license associated with your GDK

  2. Follow https://docs.gitlab.com/ee/development/database/clickhouse/clickhouse_within_gitlab.html#gdk-setup up to and including running migrations (bundle exec rake gitlab:clickhouse:migrate)

  3. Go to the shell in your GDK gitlab directory and run bundle exec rake "gitlab:seed:runner_fleet". This will seed your GDK with some runners and jobs required for testing this MR.

  4. Run the following in the rails console:

    ::Ci::Build.where.not(finished_at: nil).order(id: :desc).limit(5000).each{|build| ::Ci::FinishedBuildChSyncEvent.upsert({ build_id: build.id, build_finished_at: build.finished_at }, unique_by: [:build_id, :partition]) }
    ClickHouse::DataIngestion::CiFinishedBuildsSyncService.new.execute
  5. Run mutation in http://gdk.test:3000/-/graphql-explorer:

    Query:

    mutation runnersExportUsage($input: RunnersExportUsageInput!) {
      runnersExportUsage(input: $input) {
        errors
      }
    }

    Query variables:

    {
      "input": {
        "fullPath": "rf-top-level-group-1",
        "fromDate": "2024-01-01",
        "toDate": "2024-06-30"
      }
    }
  6. Check the email you should have received in http://gdk.test:3000/rails/letter_opener/

The email should contain the runner usage stats for the group you selected in fullPath.

Merge request reports