Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

continue on error when adding images to store #317

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmd/hauler/cli/store/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ func storeImage(ctx context.Context, s *store.Layout, i v1alpha1.Image, platform

r, err := name.ParseReference(i.Name)
if err != nil {
return err
l.Warnf("unable to parse 'image' [%s], skipping...", r.Name())
return nil
}

err = cosign.SaveImage(ctx, s, r.Name(), platform)
if err != nil {
return err
l.Warnf("unable to add 'image' [%s] to store. skipping...", r.Name())
dweomer marked this conversation as resolved.
Show resolved Hide resolved
return nil
}

l.Infof("successfully added 'image' [%s]", r.Name())
Expand Down
4 changes: 2 additions & 2 deletions pkg/cosign/cosign.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func SaveImage(ctx context.Context, s *store.Layout, ref string, platform string
// read command's stderr line by line
errors := bufio.NewScanner(stderr)
for errors.Scan() {
l.Errorf(errors.Text()) // write each line to your log, or anything you need
l.Warnf(errors.Text()) // write each line to your log, or anything you need
}
if err := errors.Err(); err != nil {
cmd.Wait()
Expand Down Expand Up @@ -200,7 +200,7 @@ func RetryOperation(ctx context.Context, operation func() error) error {
}

// Log the error for the current attempt.
l.Errorf("error (attempt %d/%d): %v", attempt, maxRetries, err)
l.Warnf("error (attempt %d/%d): %v", attempt, maxRetries, err)

// If this is not the last attempt, wait before retrying.
if attempt < maxRetries {
Expand Down