Support deleting manifest.list.v2 (#55)

Co-authored-by: Steven Beverly <steven@rigel.gopes>
This commit is contained in:
Steven Beverly 2021-04-26 05:48:55 -07:00 committed by GitHub
parent 828a5b72e3
commit a84e06443a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -293,7 +293,11 @@ func (c *Client) CountTags(interval uint8) {
func (c *Client) DeleteTag(repo, tag string) { func (c *Client) DeleteTag(repo, tag string) {
scope := fmt.Sprintf("repository:%s:*", repo) scope := fmt.Sprintf("repository:%s:*", repo)
// Get sha256 digest for tag. // 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. // Delete by manifest digest reference.
authHeader := "" authHeader := ""