Skip to content

Enable ciCatalogResource endpoint to accept a fullpath argument

What does this MR do and why?

Currently ciCatalogResource accepts GID to query for resources by id. This MR enables the endpoint to also accept full_path (project's full path) argument to query for resource.

This MR resolves #429100 (closed)

Screenshots or screen recordings

Query via GID (exisiting behaviour) Screenshot_2023-11-02_at_13.25.40 Query via full_path (introduced by this MR) Screenshot_2023-11-02_at_13.26.56 Query via full_path for a catalog resource where the project is not a catalog resource (introduced by this MR) Screenshot_2023-11-02_at_13.58.33 Query without any arguments passed (introduced by this MR) Screenshot_2023-11-10_at_10.51.34 Query with both arguments Screenshot_2023-11-10_at_10.51.09

  1. Checkout this branch and restart your server.
  2. Create a catalog resource e.g.: Typeahead.Js
  3. Run the following queries from your local host http://127.0.0.1:3000/-/graphql-explorer Query via GID (exisiting behaviour)
query getCiCatalogResource($id: CiCatalogResourceID = "gid://gitlab/Ci::Catalog::Resource/1") 
{
  ciCatalogResource(id: $id) {
    id
    icon
    name
    description
    openIssuesCount
    openMergeRequestsCount 
  } 
}

Query via full_path (introduced by this MR)

query getCiCatalogResource($full_path: ID = "twitter/Typeahead.Js") 
{
  ciCatalogResource(fullPath: $full_path) {
    id
    icon
    name
    description
    openIssuesCount
    openMergeRequestsCount 
  } 
}

Query without any arguments passed (introduced by this MR)

query getCiCatalogResource
{
  ciCatalogResource {
    id
    icon
    name
    description
    openIssuesCount
    openMergeRequestsCount 
  } 
}

Query via full_path for a catalog resource where the project is not a catalog resource (introduced by this MR)

query getCiCatalogResource($full_path: ID = "kasia-group/kasia-pro") 
{
  ciCatalogResource(fullPath: $full_path) {
    id
    icon
    name
    description
    openIssuesCount
    openMergeRequestsCount 
  } 
}

Query with both arguments should return an error.

query getCiCatalogResource($id: CiCatalogResourceID = "gid://gitlab/Ci::Catalog::Resource/1", $full_path: ID = "Typeahead.Js") 
{
  ciCatalogResource(id: $id, fullPath: $full_path) {
    id
    icon
    name
    description
    openIssuesCount
    openMergeRequestsCount 
  } 
}

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 Kasia Misirli

Merge request reports

Loading