acr icon indicating copy to clipboard operation
acr copied to clipboard

purge --untagged removes tagged images

Open fuglede opened this issue 2 years ago • 2 comments

Mirror of this issue: https://github.com/MicrosoftDocs/azure-docs/issues/81172

Describe the bug If I use acr purge --untagged, tagged images are removed.

To Reproduce I ran

az acr run --cmd "acr purge --untagged --filter 'some/repository:.*' --ago 1d" --registry myRegistry /dev/null

in a cloud shell.

Much to my surprise, this did not only remove untagged images (those whose tag is None) in that repository but removed ALL images in the repository. This seems like a huge issue.

Expected behavior Only untagged images in the repository are removed.

Any relevant environment information

  • OS: Cloud shell
  • Azure CLI/PowerShell/SDK version
{
  "azure-cli": "2.28.0",
  "azure-cli-core": "2.28.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {
    "ai-examples": "0.2.5",
    "ssh": "0.1.6"
  }
}
  • Datetime (UTC) when the issue occurred: Right now

fuglede avatar Sep 16 '21 13:09 fuglede

@toddysm should we consider deprecating this flag or renaming it. It’s a breaking change so need to do this more carefully. Gil might be able to provide some feedback on this.

sajayantony avatar Sep 16 '21 16:09 sajayantony

@fuglede - that is the right repository to open the issue.

sajayantony avatar Sep 22 '21 20:09 sajayantony

I'm using this command to remove untagged only

$PURGE_CMD="acr purge --filter '^MyRepository:THIS_IS_REQUIRED_BUT_NOT_USED$' --untagged --ago 7d --dry-run"
az acr run --cmd "$PURGE_CMD" --registry MyRegistry /dev/null

krokofant avatar Oct 26 '22 12:10 krokofant

Closing as this has been inactive. Please open a support ticket with our team for assistance.

terencet-dev avatar Nov 17 '22 20:11 terencet-dev