mirror of
https://github.com/containers/podman.git
synced 2025-11-28 17:18:58 +08:00
Image caches: allow overriding cache dir
Images were being cached in /tmp, with no option to override. Now $PODMAN_TEST_IMAGE_CACHE_DIR can be used to point to a user-preferred location. If unset, try $TMPDIR before settling on /tmp. Also: refactor the logic for determining the tarball name. Also: include registry name in tarball name. Also: clean up unused/unnecessary code Also: do not echo "Restoring..." if we're not actually restoring. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@@ -164,15 +164,16 @@ func (p *PodmanTestIntegration) SeedImages() error {
|
||||
|
||||
// RestoreArtifact puts the cached image into our test store
|
||||
func (p *PodmanTestIntegration) RestoreArtifact(image string) error {
|
||||
fmt.Printf("Restoring %s...\n", image)
|
||||
dest := strings.Split(image, "/")
|
||||
destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1))
|
||||
args := []string{"load", "-q", "-i", destName}
|
||||
podmanOptions := getRemoteOptions(p, args)
|
||||
command := exec.Command(p.PodmanBinary, podmanOptions...)
|
||||
fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " "))
|
||||
command.Start()
|
||||
command.Wait()
|
||||
tarball := imageTarPath(image)
|
||||
if _, err := os.Stat(tarball); err == nil {
|
||||
fmt.Printf("Restoring %s...\n", image)
|
||||
args := []string{"load", "-q", "-i", tarball}
|
||||
podmanOptions := getRemoteOptions(p, args)
|
||||
command := exec.Command(p.PodmanBinary, podmanOptions...)
|
||||
fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " "))
|
||||
command.Start()
|
||||
command.Wait()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user