diff --git a/internal/builder/builder.go b/internal/builder/builder.go index f6cf92720..a574774f8 100644 --- a/internal/builder/builder.go +++ b/internal/builder/builder.go @@ -306,17 +306,17 @@ func (b *Builder) Save(logger logging.Logger, creatorMetadata CreatorMetadata) e return err } - if err := b.image.AddLayer(bpLayerTar); err != nil { + diffID, err := dist.LayerDiffID(bpLayerTar) + if err != nil { return errors.Wrapf(err, - "adding layer tar for buildpack %s", + "getting content hashes for buildpack %s", style.Symbol(bp.Descriptor().Info.FullName()), ) } - diffID, err := dist.LayerDiffID(bpLayerTar) - if err != nil { + if err := b.image.AddLayerWithDiffID(bpLayerTar, diffID.String()); err != nil { return errors.Wrapf(err, - "getting content hashes for buildpack %s", + "adding layer tar for buildpack %s", style.Symbol(bp.Descriptor().Info.FullName()), ) }