Merge pull request #2876 from fuweid/bugfix_missing_snapshot_gc
bugfix: unpack should always set the snapshot gc label
This commit is contained in:
commit
c7e31f1c5e
32
image.go
32
image.go
@ -170,26 +170,22 @@ func (i *image) Unpack(ctx context.Context, snapshotterName string) error {
|
|||||||
chain = append(chain, layer.Diff.Digest)
|
chain = append(chain, layer.Diff.Digest)
|
||||||
}
|
}
|
||||||
|
|
||||||
if unpacked {
|
desc, err := i.i.Config(ctx, cs, i.platform)
|
||||||
desc, err := i.i.Config(ctx, cs, i.platform)
|
if err != nil {
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
rootfs := identity.ChainID(chain).String()
|
|
||||||
|
|
||||||
cinfo := content.Info{
|
|
||||||
Digest: desc.Digest,
|
|
||||||
Labels: map[string]string{
|
|
||||||
fmt.Sprintf("containerd.io/gc.ref.snapshot.%s", snapshotterName): rootfs,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
if _, err := cs.Update(ctx, cinfo, fmt.Sprintf("labels.containerd.io/gc.ref.snapshot.%s", snapshotterName)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
rootfs := identity.ChainID(chain).String()
|
||||||
|
|
||||||
|
cinfo := content.Info{
|
||||||
|
Digest: desc.Digest,
|
||||||
|
Labels: map[string]string{
|
||||||
|
fmt.Sprintf("containerd.io/gc.ref.snapshot.%s", snapshotterName): rootfs,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = cs.Update(ctx, cinfo, fmt.Sprintf("labels.containerd.io/gc.ref.snapshot.%s", snapshotterName))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *image) getLayers(ctx context.Context, platform platforms.MatchComparer) ([]rootfs.Layer, error) {
|
func (i *image) getLayers(ctx context.Context, platform platforms.MatchComparer) ([]rootfs.Layer, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user