Add new query for fetching container registry tag details
What does this MR do and why?
Adds new query for fetching container registry tag details.
The gitlab container registry API supports a :path/tags/detail/:name/ endpoint, which lists detailed metadata for a tag. Included in that metadata is the platform required by the image, or for image indexes, the platform required by each referenced image.
Exposing this information via graphql allows us to create UI to display the required platform for an image or the images in an index.
References
- Docs for the tags/details endpoint
- Issue: 500220, the issue requesting this feature.
How to set up and validate locally
Prerequisite: To fully validate, you'll want to have a couple entries already populated in a container registry in your evaluation instance:
- An individual image manifest.
- An image index.
- The
::Types::GlobalIDType[::ContainerRepository]ID for the repository containing each of those images.
For my local testing, I used the following, but you'll need to adapt these variables to your instance.
Variables for Image Index
{
"id": "gid://gitlab/ContainerRepository/1",
"name": "main"
}
Variables for Image Manifest
{
"id": "gid://gitlab/ContainerRepository/1",
"name": "main-linux-amd64"
}
I tested the query in graphiql (/-/graphql-explorer), with the following query:
Query nested under containerRepository
query getContainerRepositoryTagDetails($id: ContainerRepositoryID!, $name: String!) {
containerRepository(id:$id) {
name
tagDetails(name:$name) {
name
platform {
os
architecture
__typename
}
manifests {
digest
mediaType
platform {
os
architecture
__typename
}
size
__typename
}
}
}
}
Questions to answer
- Should this query be gated behind a feature flag? Not for now.
- Should we include the top-level query, the nested query, or both? Just using the nested query to cut down on MR size.
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.