Azure / acr

Azure Container Registry samples, troubleshooting tips and references
https://aka.ms/acr
Other
162 stars 106 forks source link

Rest api for get tags doesn respect n parameter (pagesize) #749

Open davesmits opened 2 months ago

davesmits commented 2 months ago

Describe the bug

According this documentation page https://learn.microsoft.com/en-us/rest/api/containerregistry/tag/get-list?view=rest-containerregistry-2019-08-15&tabs=HTTP via the n parameter the page size of the number of tags that get returned can be set.

Unfortunately; the parameter is ignored and always 1000 items are returned.

To Reproduce Steps to reproduce the behavior:

  1. fill up a repository with more then 1.000 tags
  2. call the api with n=10.000 for example
  3. notice just 1.000 tags are returned

Expected behavior Expected it would return up to 10.000 items,

Screenshots code image

output image

the 999 is because filtering the latest tag ; see code

sajayantony commented 2 months ago

@estebanreyl - could we clarify this. For /v2 the OCI specification might not be clear enough since catalog is a depreacted API. But it would be good to document what is the expected behavior of n. Tagging @toddysm

davesmits commented 1 month ago

maybe good to provide some context what we try to achieve.

We use azure devops for our pipelines. Based on the environment, with help of retention leases, we manage which releases are imported for us. The build id is in the image tag. We try to build a script that keeps the acr in sync with our pipelines; Read all tags from acr; get the buildid; find if the build id still exists in azure devops; if no remove the tag

In the past we never cleaned up the acr but even while it was not expensive; it still felt like burning money for no reason.

The limit of 1000 prevents us now to get all tags