Skip to content

Add GraphQL fields for Catalog resources

Avielle Wolfe requested to merge 393567-catalog-resources-query into master

What does this MR do and why?

This MR adds the basic structure for fetching CI catalog resources using GraphQL. It adds a Ci::Catalog::ResourceType, a Resolvers::Ci::Catalog::ResourceResolver, and a ci_catalog_resources field to QueryType.

Screenshots or screen recordings

Screen_Shot_2023-04-05_at_14.51.04

How to set up and validate locally

  1. In the Rails console, run Feature.enable(:ci_private_catalog_beta)
  2. Choose a namespace with at least one project. Find that project's ID
  3. In the Rails console, create a CI catalog resource with:
    ::Ci::Catalog::Resource.create(project: Project.find(<project_id>))
  4. In /-/graphql-explorer, use this query:
    query {
      ciCatalogResources(projectPath: "<project_path>") {
        count
      
        nodes {
          description
          icon
          name
        }
      }
    }
  5. See that you get the expected catalog resource. The name and description should match the name and description of the project. The icon should be the avatar path of the project.

MR acceptance checklist

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

Related to #393567 (closed)

Edited by Avielle Wolfe

Merge request reports