Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit 052bcec

Browse files
committed
Reuse cached filesystems for layers
This commit applies the same criteria for reusing extracted layer filesystems than the one used for the whole image extracted filesystem Signed-off-by: David Cassany <[email protected]>
1 parent 0aea57d commit 052bcec

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/util/image_utils.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ func SortMap(m map[string]string) string {
7777

7878
// GetFileSystemForLayer unpacks a layer to local disk
7979
func GetFileSystemForLayer(layer v1.Layer, root string, whitelist []string) error {
80+
empty, err := DirIsEmpty(root)
81+
if err != nil {
82+
return err
83+
}
84+
if !empty {
85+
logrus.Infof("using cached filesystem in %s", root)
86+
return nil
87+
}
8088
contents, err := layer.Uncompressed()
8189
if err != nil {
8290
return err

0 commit comments

Comments
 (0)