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

[ACR] Design discussion for az acr repository command group

Open djyou opened this issue 9 years ago • 8 comments

Description

az acr repository contains a few commands to delete a repository from a container registry or delete a manifest/tag from a repository in a container registry. Due to the complex dependency nature among docker manifest/tag/layer, using this command group becomes quite confusing and complicated.

Current implementation:

Command
    az acr repository delete: Deletes a repository or a manifest/tag from the given repository in
    the specified container registry.

Arguments
    --name -n    [Required]: The name of the container registry. You can configure the default
                             registry name using `az configure --defaults acr=<registry name>`.
    --repository [Required]: The name of repository to delete.
    --manifest             : The sha256 based digest of manifest to delete.
    --password -p          : The password used to log into a container registry.
    --resource-group -g    : Name of resource group. You can configure the default group using `az
                             configure --defaults group=<name>`.
    --tag                  : The name of tag to delete.
    --username -u          : The username used to log into a container registry.
    --yes -y               : Do not prompt for confirmation.

Examples
    Delete a repository from the specified container registry.
        az acr repository delete -n MyRegistry --repository MyRepository

    Delete a tag from the given repository. This operation does not delete the manifest referenced
    by the tag or associated layer data.
        az acr repository delete -n MyRegistry --repository MyRepository --tag MyTag

    Delete the manifest referenced by a tag. This operation also deletes associated layer data and
    all other tags referencing the manifest.
        az acr repository delete -n MyRegistry --repository MyRepository --tag MyTag --manifest

    Delete a manfiest from the given repository. This operation also deletes associated layer data
    and all tags referencing the manifest.
        az acr repository delete -n MyRegistry --repository MyRepository --manifest MyManifest

Proposed implementation

Assuming sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7 is the manifest digest for the image hello-world:latest.

Delete image by manifest digest

az acr repository delete --name MyRegistry --image hello-world@sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7

Ask for confirmation, this will delete the manifest sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7 from repository hello-world and all tags referencing it. This will further result in automatic layer data purging.

Delete image by tag

az acr repository delete --name MyRegistry --image hello-world:latest

Ask for confirmation, this will delete the manifest that is referenced by tag latest (e.g., sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7) from repository hello-world and all tags referencing it. This will further result in automatic layer data purging.

Delete a tag

az acr repository untag --name MyRegistry --image hello-world:latest

This will simply delete the tag latest from repository hello-world. The image hello-world:latest can no longer be pulled, but the manifest sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7 and all associated layer data still exist.

Delete a repository

az acr repository delete --name MyRegistry --repository hello-world

The same as the current implementation. All tags, manifests, and layer data will be deleted.

Any suggestions are appreciated.

/cc @SajayAntony @sivagms @SteveLasker

djyou avatar Jul 20 '17 22:07 djyou

@djyou - This is non-breaking and I believe is cleaner overall. @Stevelas unless you have another proposal, can we move ahead with this?

sajayantony avatar Feb 20 '18 23:02 sajayantony

@sajayantony lets just ping a few folks to confirm. We'll shoot for closing by Monday, 2/26

SteveLasker avatar Feb 21 '18 22:02 SteveLasker

One thing that jumps out to me is the untag command--perhaps that could instead be delete-tag so as to keep it within the "delete" command family?

EDIT: Or was that intentional so as to indicate that no image data is truly deleted?

mmacy avatar Feb 23 '18 18:02 mmacy

Just to clarify, I can mechanically translate the proposed "Delete image by manifest digest" syntax

az acr repository delete --name MyRegistry --image hello-world@sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7

to today's existing syntax like this?

az acr repository delete --name MyRegistry --repository hello-world --manifest sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7

chwarr avatar Feb 23 '18 21:02 chwarr

@chwarr Yes the two commands are identical. This is not a breaking change so the old commands can still work.

djyou avatar Feb 23 '18 22:02 djyou

@mmacy We tried to avoid the word delete since untag operation doesn't delete data and each tag is more of an alias to a manifest.

djyou avatar Feb 23 '18 22:02 djyou

As a part of this should we also output a warning on the delete tag(without manifest) saying that the image is not deleted and the command will be deprecated and use the --image api's?

sajayantony avatar Feb 23 '18 22:02 sajayantony

@chwarr there's been a lot of confusion on how customers can actually free up space. using the delete, with --image will help customers understand how to delete.

Based on the weeks feedback, seems we're good to go with this change...

SteveLasker avatar Feb 26 '18 18:02 SteveLasker