Skip to content

Commit 386b4e9

Browse files
authored
Merge pull request #2240 from dmcgowan/backport-fix-uncompressed-label
[release/1.0] client/pull: fix label being put on snapshot instead of content
2 parents bde0036 + 457c658 commit 386b4e9

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

image.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/containerd/containerd/images"
1010
"github.com/containerd/containerd/platforms"
1111
"github.com/containerd/containerd/rootfs"
12-
"github.com/containerd/containerd/snapshots"
1312
digest "github.com/opencontainers/go-digest"
1413
"github.com/opencontainers/image-spec/identity"
1514
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
@@ -108,15 +107,25 @@ func (i *image) Unpack(ctx context.Context, snapshotterName string) error {
108107
unpacked bool
109108
)
110109
for _, layer := range layers {
111-
labels := map[string]string{
112-
"containerd.io/uncompressed": layer.Diff.Digest.String(),
113-
}
114-
115-
unpacked, err = rootfs.ApplyLayer(ctx, layer, chain, sn, a, snapshots.WithLabels(labels))
110+
unpacked, err = rootfs.ApplyLayer(ctx, layer, chain, sn, a)
116111
if err != nil {
117112
return err
118113
}
119114

115+
if unpacked {
116+
// Set the uncompressed label after the uncompressed
117+
// digest has been verified through apply.
118+
cinfo := content.Info{
119+
Digest: layer.Blob.Digest,
120+
Labels: map[string]string{
121+
"containerd.io/uncompressed": layer.Diff.Digest.String(),
122+
},
123+
}
124+
if _, err := cs.Update(ctx, cinfo, "labels.containerd.io/uncompressed"); err != nil {
125+
return err
126+
}
127+
}
128+
120129
chain = append(chain, layer.Diff.Digest)
121130
}
122131

0 commit comments

Comments
 (0)