Merge pull request #1529 from tonistiigi/migrate-fix

cache: avoid snapshot migration on shallow refs
v0.8
Tõnis Tiigi 2020-06-14 21:53:06 -07:00 committed by GitHub
commit df35e9818d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 12 deletions

3
cache/migrate_v2.go vendored
View File

@ -205,6 +205,8 @@ func MigrateV2(ctx context.Context, from, to string, cs content.Store, s snapsho
// remove old root labels
for _, item := range byID {
em := getEqualMutable(item)
if em == "" {
if _, err := s.Update(ctx, snapshots.Info{
Name: getSnapshotID(item),
}, "labels.containerd.io/gc.root"); err != nil {
@ -221,6 +223,7 @@ func MigrateV2(ctx context.Context, from, to string, cs content.Store, s snapsho
}
}
}
}
// previous implementation can leak views, just clean up all views
err = s.Walk(ctx, func(ctx context.Context, info snapshots.Info) error {