From a99f2d48e5ec5e80ca9235933ccf303de769d7b6 Mon Sep 17 00:00:00 2001 From: Steven Beverly Date: Sat, 24 Oct 2020 21:55:11 -0700 Subject: [PATCH] Support deleting manifest.list.v2 --- registry/client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/registry/client.go b/registry/client.go index eba7049..03cc38f 100644 --- a/registry/client.go +++ b/registry/client.go @@ -293,7 +293,11 @@ func (c *Client) CountTags(interval uint8) { func (c *Client) DeleteTag(repo, tag string) { scope := fmt.Sprintf("repository:%s:*", repo) // Get sha256 digest for tag. - _, resp := c.callRegistry(fmt.Sprintf("/v2/%s/manifests/%s", repo, tag), scope, "manifest.v2") + _, resp := c.callRegistry(fmt.Sprintf("/v2/%s/manifests/%s", repo, tag), scope, "manifest.list.v2") + + if resp.Header.Get("Content-Type") != "application/vnd.docker.distribution.manifest.list.v2+json" { + _, resp = c.callRegistry(fmt.Sprintf("/v2/%s/manifests/%s", repo, tag), scope, "manifest.v2") + } // Delete by manifest digest reference. authHeader := ""