GraphQL: Fix sort order of CiRunner.projects

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR fixes a bug that was introduced by the changes to fix N+1 issues, where the sort order stopped being preserved.

Closes #407853 (closed)

Screenshots or screen recordings

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

image

How to set up and validate locally

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

  1. Go to the shell in your GDK gitlab directory and run bundle exec rake 'gitlab:seed:runner_fleet[root, rf5-, 10, 400]'. This will seed your GDK with some projects and runners required for testing this MR.

  2. Go to http://gdk.test:3000/-/graphql-explorer and execute the following query:

    {
      project(
        fullPath: "rf5-top-level-group-1/rf5-group-1.1/rf5-group-1.1.1/rf5-project-1-1-1-1"
      ) {
        runners(type: PROJECT_TYPE) {
          nodes {
            id
            projectCount
            projects(search: "rf5-", sort: "id_desc") {
              nodes {
                id
                fullPath
              }
            }
          }
        }
      }
    }
  3. Looking at a runner that contains multiple projects, the projects should be sorted by the requested order (try changing to "id_asc", for instance).

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 Pedro Pombeiro

Merge request reports

Loading