Skip to content

Commit

Permalink
Initialize default LayerMetadataRestorer and SBOMRestorer if none pro…
Browse files Browse the repository at this point in the history
…vided (#1333)

Signed-off-by: Pavel Busko <[email protected]>
Co-authored-by: Ralf Pannemans <[email protected]>
  • Loading branch information
pbusko and c0d1ngm0nk3y authored Apr 11, 2024
1 parent 85f22a0 commit 27ee435
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions phase/restorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ func (r *Restorer) Restore(cache Cache) error {
return err
}

if r.LayerMetadataRestorer == nil {
r.LayerMetadataRestorer = layer.NewDefaultMetadataRestorer(r.LayersDir, false, r.Logger)
}

if r.SBOMRestorer == nil {
r.SBOMRestorer = layer.NewSBOMRestorer(layer.SBOMRestorerOpts{
LayersDir: r.LayersDir,
Logger: r.Logger,
Nop: false,
}, r.PlatformAPI)
}

layerSHAStore := layer.NewSHAStore()
r.Logger.Debug("Restoring Layer Metadata")
if err := r.LayerMetadataRestorer.Restore(r.Buildpacks, r.LayersMetadata, cacheMeta, layerSHAStore); err != nil {
Expand Down

0 comments on commit 27ee435

Please sign in to comment.