From 27ee43580b1eb599479d3cc4689f965624e772f6 Mon Sep 17 00:00:00 2001 From: Pavel Busko Date: Thu, 11 Apr 2024 17:43:22 +0200 Subject: [PATCH] Initialize default LayerMetadataRestorer and SBOMRestorer if none provided (#1333) Signed-off-by: Pavel Busko Co-authored-by: Ralf Pannemans --- phase/restorer.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/phase/restorer.go b/phase/restorer.go index 30357c52e..48b6da59e 100644 --- a/phase/restorer.go +++ b/phase/restorer.go @@ -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 {