Skip to content

Commit

Permalink
is now working w/ nvidia package
Browse files Browse the repository at this point in the history
Signed-off-by: razzle <harry@razzle.cloud>
  • Loading branch information
Noxsios committed May 13, 2024
1 parent 08096fa commit 82ae27b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/internal/packager/images/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ package images
import (
"context"
"encoding/json"
"errors"
"fmt"
"io/fs"
"maps"
"os"
"path/filepath"
Expand Down Expand Up @@ -268,6 +270,9 @@ func CleanupInProgressLayers(ctx context.Context, img v1.Image) error {
cacheDir := filepath.Join(config.GetAbsCachePath(), layout.ImagesDir)
location := filepath.Join(cacheDir, digest.String())
info, err := os.Stat(location)
if errors.Is(err, fs.ErrNotExist) {
return nil
}
if err != nil {
return err
}
Expand All @@ -290,8 +295,8 @@ func SaveSequential(ctx context.Context, cl clayout.Path, m map[transform.Image]
ocispec.AnnotationBaseImageName: info.Reference,
}
if err := cl.AppendImage(img, clayout.WithAnnotations(annotations)); err != nil {
if err = CleanupInProgressLayers(ctx, img); err != nil {
message.WarnErr(err, "failed to clean up in-progress layers, please remove them manually")
if err := CleanupInProgressLayers(ctx, img); err != nil {
message.WarnErr(err, "failed to clean up in-progress layers, please run `zarf tools clear-cache`")
}
return saved, err
}
Expand All @@ -318,8 +323,8 @@ func SaveConcurrent(ctx context.Context, cl clayout.Path, m map[transform.Image]
}

if err := cl.WriteImage(img); err != nil {
if err = CleanupInProgressLayers(ectx, img); err != nil {
message.WarnErr(err, "failed to clean up in-progress layers, please remove them manually")
if err := CleanupInProgressLayers(ectx, img); err != nil {
message.WarnErr(err, "failed to clean up in-progress layers, please run `zarf tools clear-cache`")
}
return err
}
Expand Down

0 comments on commit 82ae27b

Please sign in to comment.