Skip to content

Revert ReleasesResolver and add Ci Catalog VersionsResolver

What does this MR do and why?

In #413129 (closed), it was discovered that a recent change to the ReleasesResolver in !120811 (merged) caused the /releases page to break when a project does not have releases.

This is because !120811 (merged) updated the resolver to use BatchLoader to support multiple projects as input, and only projects that have releases are mapped to a non-null value. This resulted in the GraphQL response to return a null value instead of the expected empty array [].

Per #413129 (comment 1413537463):

BEFORE !120811 (merged) result

{
   "data" : {
      "project" : {
         "name" : "Pipeline Tests",
         "releases" : {
            "nodes" : []
         }
      }
   }
}

AFTER !120811 (merged) result

{
   "data" : {
      "project" : {
         "name" : "Pipeline Tests",
         "releases" : null
      }
   }
}

It was decided to move the ReleasesResolver code into a new VersionsResolver and revert the changes to ReleasesResolver.

This both fixes the regression that was introduced by !120811 (merged) and continues to support the versions field of CiCatalogResource.

Screenshots

BEFORE AFTER
Screenshot_2023-06-01_at_9.39.17_AM Screenshot_2023-06-01_at_9.38.44_AM

How to set up and validate locally

  1. Create or find a project that does not have any Releases.
  2. Before checking out this branch, go to http://gdk.test:3000/-/graphql-explorer and observe that the following query produces a null output. (Adjust the project's fullPath as necessary).
query allReleases {
  project(fullPath: "group-a/project-1") {
    id
    releases {
      nodes {
        id
        name
      }
    }
  }
}

image

  1. Also observe that when you go to the project's Releases page on the UI, the page does not load.

  2. Now checkout this branch and re-run the query. Observe that now the response returns an empty array as expected.

Screenshot_2023-06-01_at_9.36.52_AM

  1. And observe that the project's Releases page is populated as expected.

To validate that the CiCatalogResource.versions field is still supported, please follow the steps outlined here. Also note that the response has been updated to match the behaviour of ReleasesResolver so that it returns an empty Array [] rather than null when a Catalog Resource does not have versions.

Specifically, it changed from:

        {
          "name": "Project Catalog Resource 1",
          "versions": null
        }

to

        {
          "name": "Project Catalog Resource 1",
          "versions": {
            "nodes": []
          }
        }

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 #413129 (closed)

Edited by Leaminn Ma

Merge request reports