Skip to content

Commit 68162ec

Browse files
authored
Add a sanity check to ensure content is written and addressable (#23)
1 parent fc85b8d commit 68162ec

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

pkg/snapshot/overlay.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,14 @@ func (o *snapshotter) Compare(ctx context.Context, lower, upper []mount.Mount, o
14561456
}
14571457

14581458
digest := writer.Digest()
1459+
1460+
// Sanity check that the content exists
1461+
_, err = cs.Info(ctx, digest)
1462+
if err != nil {
1463+
logrus.Errorln("failed to get info from content store:", err)
1464+
return ocispec.Descriptor{}, err
1465+
}
1466+
14591467
desc := ocispec.Descriptor{
14601468
MediaType: config.MediaType,
14611469
Digest: digest,
@@ -1467,6 +1475,7 @@ func (o *snapshotter) Compare(ctx context.Context, lower, upper []mount.Mount, o
14671475
label.OverlayBDBlobFsType: "ext4",
14681476
},
14691477
}
1478+
14701479
logrus.Infof("Diff created with spec %+v", desc)
14711480
return desc, nil
14721481
}

0 commit comments

Comments
 (0)