-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fetch and save container images only once (#1938)
* 🐛 Fetch and save container images only once Fixes #1771 Signed-off-by: Christian Zunker <[email protected]> * Fix license header Signed-off-by: Christian Zunker <[email protected]> * Fix tests Signed-off-by: Christian Zunker <[email protected]> --------- Signed-off-by: Christian Zunker <[email protected]>
- Loading branch information
Showing
5 changed files
with
97 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Mondoo, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
package image | ||
|
||
import ( | ||
"io" | ||
"os" | ||
|
||
v1 "github.com/google/go-containerregistry/pkg/v1" | ||
"github.com/google/go-containerregistry/pkg/v1/tarball" | ||
) | ||
|
||
func LoadImageFromDisk(filepath string) (v1.Image, io.ReadCloser, error) { | ||
img, err := tarball.ImageFromPath(filepath, nil) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
rc, err := os.Open(filepath) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
|
||
return img, rc, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters