|
9 | 9 | "github.com/containerd/containerd/images" |
10 | 10 | "github.com/containerd/containerd/platforms" |
11 | 11 | "github.com/containerd/containerd/rootfs" |
12 | | - "github.com/containerd/containerd/snapshots" |
13 | 12 | digest "github.com/opencontainers/go-digest" |
14 | 13 | "github.com/opencontainers/image-spec/identity" |
15 | 14 | ocispec "github.com/opencontainers/image-spec/specs-go/v1" |
@@ -108,15 +107,25 @@ func (i *image) Unpack(ctx context.Context, snapshotterName string) error { |
108 | 107 | unpacked bool |
109 | 108 | ) |
110 | 109 | 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) |
116 | 111 | if err != nil { |
117 | 112 | return err |
118 | 113 | } |
119 | 114 |
|
| 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 | + |
120 | 129 | chain = append(chain, layer.Diff.Digest) |
121 | 130 | } |
122 | 131 |
|
|
0 commit comments