Create CI Catalog resolver for a single resource
What does this MR do and why?
Adding a single catalog resource graphQL endpoint. Addressing following issue.
Screenshots or screen recordings
See below.
How to set up and validate locally (command line)
- Enable feature flags:
Feature.enable(:ci_namespace_catalog_experimental)
Feature.enable(:ci_namespace_catalog)
License.feature_available?(:ci_namespace_catalog) #get license if this is not true.
- Create a project that belongs to a namespace.
- Add the current user (id: 1) as owner to the namespace.
- Create Ci::Catalog::Resource in your console
project = Project.last
resource = Ci::Catalog::Resource.new(project: project)
resource.save!
- In the console:
current_user = User.find_by_id(1)
query = <<~EOQ
query getCiCatalogResource($id: CiCatalogResourceID!)
{
ciCatalogResource(id: $id) {
id
description
name
icon
}
}
EOQ
variables = {"id": "gid://gitlab/Ci::Catalog::Resource/1"}
result = GitlabSchema.execute(query, variables: variables, context: { current_user: current_user })
result.to_h
graphQL interface)
How to set up and validate locally (When user is authorised to see a catalog resource
When user is not authorised to see a catalog resource
When requested resource does not exist
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.
Edited by Furkan Ayhan