Skip to content

Commit

Permalink
test: Suppress the logs when Unpack function
Browse files Browse the repository at this point in the history
Suppress logs from Unpack function which is causing errors to be written
to the benchmark results.

Signed-off-by: Edmund Ochieng <[email protected]>
  • Loading branch information
OchiengEd committed Jul 31, 2024
1 parent a9fade1 commit 311fe2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/rukpak/source/image_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func (i *ImageRegistry) Unpack(ctx context.Context, bundle *BundleSource) (*Resu
}
authChain, err := k8schain.NewInCluster(ctx, chainOpts)
if err != nil {
l.Error(err, "we encountered an issue getting auth keychain")
return nil, fmt.Errorf("error getting auth keychain: %w", err)
}

Expand Down Expand Up @@ -114,17 +115,16 @@ func (i *ImageRegistry) Unpack(ctx context.Context, bundle *BundleSource) (*Resu
hexVal := strings.TrimPrefix(digest.DigestStr(), "sha256:")
unpackPath := filepath.Join(i.BaseCachePath, bundle.Name, hexVal)
if stat, err := os.Stat(unpackPath); err == nil && stat.IsDir() {
l.V(1).Info("found image in filesystem cache", "digest", hexVal)
return unpackedResult(os.DirFS(unpackPath), bundle, digest.String()), nil
}
}

// always fetch the hash
imgDesc, err := remote.Head(imgRef, remoteOpts...)
if err != nil {
l.Error(err, "failed fetching image descriptor")
return nil, fmt.Errorf("error fetching image descriptor: %w", err)
}
l.V(1).Info("resolved image descriptor", "digest", imgDesc.Digest.String())

unpackPath := filepath.Join(i.BaseCachePath, bundle.Name, imgDesc.Digest.Hex)
if _, err = os.Stat(unpackPath); errors.Is(err, os.ErrNotExist) { //nolint: nestif
Expand Down

0 comments on commit 311fe2b

Please sign in to comment.