Skip to content

GraphQL: Add resolver to runner projects

This MR is based on the pedropombeiro/352886/0-add-project-policy-preloader branch, please change to master before merging Merged now!

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR adds a resolver to the :projects field of the CiRunner GraphQL type. This enables performing searches on the projects associated with the runner.

It extracts the project search arguments from the existing Resolvers::ProjectsResolver into a concern so that they can be shared among both resolvers (given that both resolvers then hand off the search to the same finder ProjectsFinder).

Part of Improve ability to search for an assigned proje... (#352886 - 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. Register a GitLab Runner against the http://gdk.test:3000/gitlab-org/gitlab-test project using the token in the Runners section in http://gdk.test:3000/gitlab-org/gitlab-test/-/settings/ci_cd

  2. Go to the Runners section of a different project (e.g. http://gdk.test:3000/gitlab-org/gitlab-shell/-/settings/ci_cd) and enable the new runner for that project too.

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

    {
      runners(type:PROJECT_TYPE) {
        nodes {
          id
          projects(search:"Gitlab", searchNamespaces: true, sort: "name_asc") {
            count
            nodes {
              id
              name
              namespace {
                fullName
              }
            }
          }
        }
      }
    }
  4. You should see the runner and its associated projects. By playing with the resolver arguments you should get the expected behavior.

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 Miguel Rincon

Merge request reports