acr-cli icon indicating copy to clipboard operation
acr-cli copied to clipboard

Do not list repositories if the repository filters are not regexes

Open JRBANCEL opened this issue 5 months ago • 1 comments

Purpose of the PR As explained in https://github.com/Azure/acr-cli/pull/353, listing all the repositories can possibly never complete, or with the workaround from that PR, it can still take hours in large ACRs.

The problem is that in a very common scenario (the repository not being a regex), there is absolutely no need to list the repositories in the first place.

This PR simply checks that none of the repository parts of the provided filters are regex and if that's the case, use those as repository names instead of calling the potentially very expensive GetAllRepositoryNames.

We use this in our ACRs with ACR tasks for each known large repositories like purge --filter '<REPOSITORY>:.*' and it is instantaneous instead of taking hours.

JRBANCEL avatar Sep 17 '24 05:09 JRBANCEL