mirror of
https://github.com/goharbor/harbor
synced 2025-04-13 20:01:31 +00:00
remove artifact_blob with aritfact deletion (#17913)
fixes #17857 It needs to clean the artifact_blob records on artifact deletion in GC Signed-off-by: Wang Yan <wangyan@vmware.com> Signed-off-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
parent
a90181e312
commit
d83cee083a
|
@ -326,6 +326,14 @@ func (gc *GarbageCollector) sweep(ctx job.Context) error {
|
|||
continue
|
||||
}
|
||||
|
||||
gc.logger.Infof("[%d/%d] delete artifact blob record from database: %d, %s, %s", idx, total, art.ID, art.RepositoryName, art.Digest)
|
||||
if err := ignoreNotFound(func() error {
|
||||
return gc.blobMgr.CleanupAssociationsForArtifact(ctx.SystemContext(), art.Digest)
|
||||
}); err != nil {
|
||||
gc.logger.Errorf("[%d/%d] failed to call gc.blobMgr.CleanupAssociationsForArtifact(): %v, errMsg=%v", idx, total, art.Digest, err)
|
||||
return err
|
||||
}
|
||||
|
||||
gc.logger.Infof("[%d/%d] delete artifact trash record from database: %d, %s, %s", idx, total, art.ID, art.RepositoryName, art.Digest)
|
||||
if err := ignoreNotFound(func() error {
|
||||
return gc.artrashMgr.Delete(ctx.SystemContext(), art.ID)
|
||||
|
|
Loading…
Reference in New Issue
Block a user