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 1 year ago • 3 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

@Wwwsylvia, @estebanreyl, @northtyphoon, @sajayantony, @shizhMSFT, @wangxiaoxuan273, @wju-MSFT can someone PTAL?

JRBANCEL avatar Oct 23 '24 19:10 JRBANCEL

This is a nice optimization. Sorry for the late response, I missed the original ping.

estebanreyl avatar Oct 23 '24 23:10 estebanreyl

@estebanreyl are you going to look at this? If not who can?

JRBANCEL avatar Feb 25 '25 02:02 JRBANCEL