Skip to content

Add additional parameters and return value to ContainerRegistry::GitlabApiClient#tags

Context 🌅

Today, we have the epic: Use new container registry API for listing repo... (&10208 - closed) that aims to implement the usage of the new API to list repository tags. After the investigation in #403314 (closed), the list repository tags API endpoint will be updated in container-registry#1012 (closed), container-registry#1000 (closed), and container-registry#1008 (closed) to support the functionalities we need in listing registry tags in the Gitlab UI.

After the three issues in the Container Registry is done, this issue aims to update the implementation of ContainerRegistry::GitlabApiClient#tags to support the additional parameters and return value of the list repository tags API endpoint.

ContainerRegistry::GitlabApiClient#tags is the main interface on the rails side to the /gitlab/v1/* endpoints.

Implementation Plan 🗺

Pagination can go both ways, both forward and backward. After the updates to the API endpoint, we would now be able to send in a before parameter in addition to the existing last and n parameters. The list repository tags endpoint will also support sorting and filtering by name so we can send in the extra parameters for these as well.

  1. We first update ContainerRegistry::GitlabApiClient#tags to receive the following new parameters and pass them to the /gitlab/v1/repositories/#{path}/tags/list/ endpoint and update the tests accordingly.
  1. We also update the tests for ContainerRegistry::GitlabApiClient#tags and assert that the pagination can receive both next and previous in the pagination value of the result hash. Today, we only receive the next link, but in Add ability to perform backward pagination in L... (container-registry#1012 - closed), the previous link will be added as well in the return value.
{
  pagination: { next: { uri: URI(next_page_url) }, previous: { uri: URI(previous_page_url) } },
  response_body: ::Gitlab::Json.parse(response.to_json)
}
Edited by Adie (she/her)