Add GraphQL query to get container virtual registry details
What does this MR do and why?
This MR adds a GraphQL query to get the details of a specific container virtual registry. It allow users to retrieve information about container virtual registries, including their associated upstream registries. This feature is marked as experimental and was introduced in GitLab version 18.7.
Maven counterpart: https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/graphql/ee/types/query_type.rb#L416
There is also an opportunity to extract common fields to interfaces and this will be addressed in the following follow up issues:
- Add interface for RegistryUpstreamType for reus... (#583072)
- Add interface for UpstreamType (#583074)
How to set up and validate locally
🍏 Prerequisites
- A container virtual registry:
virtual_registry = VirtualRegistries::Container::Registry.first - The group of the container virtual registry:
group = virtual_registry.group - The virtual registry feature being available:
VirtualRegistries::Container.feature_enabled?(group). If not, verify that you have the following conditions satisfied- Dependency proxy enabled
- Feature
container_virtual_registriesis enabled - Licensed feature
container_virtual_registryis available (setup Premium/Ultimate if it's isn't) -
::VirtualRegistries::Setting.find_for_group(group).enabledistrue
🍉 GraphQL Query
You can try the following GraphQL query locally. Make sure you are logged in with a user that has permission. You can try with root locally.
query {
virtualRegistriesContainerRegistry(id: "gid://gitlab/VirtualRegistries::Container::Registry/1") {
id
name
registryUpstreams {
id
position
upstream {
id
name
}
}
}
}
🍋 Results
The results to the query above will be something like. It might differ depending on what you have in your local database.
{
"data": {
"virtualRegistriesContainerRegistry": {
"id": "gid://gitlab/VirtualRegistries::Container::Registry/1",
"name": "The Test VR",
"registryUpstreams": [
{
"id": "gid://gitlab/VirtualRegistries::Container::RegistryUpstream/1",
"position": 1,
"upstream": {
"id": "gid://gitlab/VirtualRegistries::Container::Upstream/1",
"name": "upstream1"
}
},
{
"id": "gid://gitlab/VirtualRegistries::Container::RegistryUpstream/2",
"position": 2,
"upstream": {
"id": "gid://gitlab/VirtualRegistries::Container::Upstream/2",
"name": "upstream2"
}
}
]
}
},
"correlationId": "01KBTS1AZSSDSDJ02YRHY8N"
}
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #579599 (closed)