fix setting uncompressed label on content
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>docker-18.09
parent
ab6a2dc83e
commit
89e8097d4c
|
@ -115,7 +115,7 @@ func getDiffPairs(ctx context.Context, contentStore content.Store, snapshotter s
|
|||
}
|
||||
diffIDStr, ok := info.Labels[containerdUncompressed]
|
||||
if !ok {
|
||||
return nil, errors.Errorf("invalid differ response with no diffID")
|
||||
return nil, errors.Errorf("invalid differ response with no diffID: %v", descr.Digest)
|
||||
}
|
||||
diffIDDigest, err := digest.Parse(diffIDStr)
|
||||
if err != nil {
|
||||
|
|
|
@ -107,10 +107,21 @@ func (s *Snapshotter) GetBlob(ctx context.Context, key string) (digest.Digest, d
|
|||
// Checks that there is a blob in the content store.
|
||||
// If same blob has already been set then this is a noop.
|
||||
func (s *Snapshotter) SetBlob(ctx context.Context, key string, diffID, blobsum digest.Digest) error {
|
||||
_, err := s.opt.Content.Info(ctx, blobsum)
|
||||
info, err := s.opt.Content.Info(ctx, blobsum)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, ok := info.Labels["containerd.io/uncompressed"]; !ok {
|
||||
labels := map[string]string{
|
||||
"containerd.io/uncompressed": diffID.String(),
|
||||
}
|
||||
if _, err := s.opt.Content.Update(ctx, content.Info{
|
||||
Digest: blobsum,
|
||||
Labels: labels,
|
||||
}, "labels.containerd.io/uncompressed"); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
md, _ := s.opt.MetadataStore.Get(key)
|
||||
|
||||
v, err := metadata.NewValue(DiffPair{DiffID: diffID, Blobsum: blobsum})
|
||||
|
|
|
@ -242,7 +242,6 @@ func unpack(ctx context.Context, desc ocispec.Descriptor, cs content.Store, csh
|
|||
for _, layer := range layers {
|
||||
labels := map[string]string{
|
||||
"containerd.io/gc.root": time.Now().UTC().Format(time.RFC3339Nano),
|
||||
"containerd.io/uncompressed": layer.Diff.Digest.String(),
|
||||
}
|
||||
if _, err := rootfs.ApplyLayer(ctx, layer, chain, csh, applier, ctdsnapshot.WithLabels(labels)); err != nil {
|
||||
return "", err
|
||||
|
|
|
@ -388,10 +388,7 @@ func (w *Worker) unpack(ctx context.Context, descs []ocispec.Descriptor, s cdsna
|
|||
|
||||
var chain []digest.Digest
|
||||
for _, layer := range layers {
|
||||
labels := map[string]string{
|
||||
"containerd.io/uncompressed": layer.Diff.Digest.String(),
|
||||
}
|
||||
if _, err := rootfs.ApplyLayer(ctx, layer, chain, s, w.Applier, cdsnapshot.WithLabels(labels)); err != nil {
|
||||
if _, err := rootfs.ApplyLayer(ctx, layer, chain, s, w.Applier); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
chain = append(chain, layer.Diff.Digest)
|
||||
|
|
Loading…
Reference in New Issue