Skip to content

Commit

Permalink
fix: only delete gc related labels
Browse files Browse the repository at this point in the history
Signed-off-by: Yadong Ding <ding_yadong@foxmail.com>
  • Loading branch information
Desiki-high committed Oct 9, 2023
1 parent 9c86e7c commit 17860b1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/content/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"path/filepath"
"strconv"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -276,9 +277,12 @@ func (content *Content) Info(ctx context.Context, dgst digest.Digest) (ctrconten

func (content *Content) Update(ctx context.Context, info ctrcontent.Info, fieldpaths ...string) (ctrcontent.Info, error) {
// containerd content store write labels to annotate some blobs belong to a same repo,
// cleaning labels is needed by GC
if info.Labels != nil {
info.Labels = nil
// cleaning gc related labels
for k := range info.Labels {
if strings.HasPrefix(k, "containerd.io/gc") {
fmt.Println(k)
delete(info.Labels, k)
}
}
return content.store.Update(ctx, info, fieldpaths...)
}
Expand Down

0 comments on commit 17860b1

Please sign in to comment.