mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 20:38:08 +08:00
fix(storage): deleting manifests with identical digests (#951)
Suppose we push two identical manifests (sharing same digest) but with different tags, then deleting by digest should throw an error otherwise we end up deleting all image tags (with gc) or dangling references (without gc) This behaviour is controlled via Authorization, added a new policy action named detectManifestsCollision which enables this behaviour Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com> Signed-off-by: Petu Eusebiu <peusebiu@cisco.com> Co-authored-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
@@ -21,7 +21,7 @@ type MockedImageStore struct {
|
||||
GetImageTagsFn func(repo string) ([]string, error)
|
||||
GetImageManifestFn func(repo string, reference string) ([]byte, godigest.Digest, string, error)
|
||||
PutImageManifestFn func(repo string, reference string, mediaType string, body []byte) (godigest.Digest, error)
|
||||
DeleteImageManifestFn func(repo string, reference string) error
|
||||
DeleteImageManifestFn func(repo string, reference string, detectCollision bool) error
|
||||
BlobUploadPathFn func(repo string, uuid string) string
|
||||
NewBlobUploadFn func(repo string) (string, error)
|
||||
GetBlobUploadFn func(repo string, uuid string) (int64, error)
|
||||
@@ -136,9 +136,9 @@ func (is MockedImageStore) GetImageTags(name string) ([]string, error) {
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
func (is MockedImageStore) DeleteImageManifest(name string, reference string) error {
|
||||
func (is MockedImageStore) DeleteImageManifest(name string, reference string, detectCollision bool) error {
|
||||
if is.DeleteImageManifestFn != nil {
|
||||
return is.DeleteImageManifestFn(name, reference)
|
||||
return is.DeleteImageManifestFn(name, reference, detectCollision)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user