Limit GQL CiCatalogResource `versions` field to single resource request
What does this MR do and why?
This MR accomplishes the following:
- Resolves the last step of #414500 (closed). The
versions
field is no longerdeprecated
because it is still required by theciCatalogResource
(single resource) endpoint. Instead, it is reverted back toalpha
state and limited to only a single Catalog Resource node. Performance degradation occurs if it is called on more than one node. - Batching has been removed from
VersionsResolver
and it has been updated to inherit from theReleasesResolver
. - Refactored the single resource spec (
ee/spec/requests/api/graphql/ci/catalog/resource_spec.rb
) so that it is consistent with the one for multiple resources (ee/spec/requests/api/graphql/ci/catalog/resources_spec.rb
.
How to set up and validate locally
- In the Rails console, run
Feature.enable(:ci_namespace_catalog_experimental)
. - Create a Catalog Resource with an existing or new Project:
::Ci::Catalog::Resource.create(project: Project.find(<project_id>))
- Ensure that the Project has a non-empty description and also has a README file. (This is required for you to successfully create a Release on the Catalog Resource.)
- Create at least one Tag and one Release on the Project. (Note that a Release is equivalent to a Version of the Catalog Resource.)
- Go to
http://gdk.test:3000/-/graphql-explorer
and run the following query (adjust theid
as necessary):
query getCiCatalogResources {
ciCatalogResource(id: "gid://gitlab/Ci::Catalog::Resource/2") {
id
name
versions {
nodes {
tagName
releasedAt
author {
id
name
webUrl
}
}
}
}
}
Observe that the output shows the correct Catalog Resource information along with the versions data.
-
Repeat Step 2 to create at least one other Catalog Resource under the same root namespace as the one created in Step 2.
-
Now run the following query (adjust
projectPath
as necessary):
query getCiCatalogResources {
ciCatalogResources(projectPath: "group-a/project-catalog-resource-1") {
nodes {
id
name
versions {
nodes {
tagName
releasedAt
author {
id
name
webUrl
}
}
}
}
}
}
Observe that an error results which indicates that the versions
field can only be requested for 1 resource at a time:
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #414500 (closed)
Edited by Leaminn Ma