From f722312e10d2bfc0f09aad9e8fbae89ed3fd5f48 Mon Sep 17 00:00:00 2001 From: Juan Bustamante Date: Fri, 26 Apr 2024 17:00:19 -0500 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Natalie Arellano Co-authored-by: Ralf Pannemans Signed-off-by: Juan Bustamante --- internal/builder/image_fetcher_wrapper.go | 6 +++--- pkg/client/client.go | 4 ++-- pkg/image/fetcher.go | 5 ++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/internal/builder/image_fetcher_wrapper.go b/internal/builder/image_fetcher_wrapper.go index 71fbebf54d..16bf39b2a7 100644 --- a/internal/builder/image_fetcher_wrapper.go +++ b/internal/builder/image_fetcher_wrapper.go @@ -14,11 +14,11 @@ type ImageFetcher interface { // attempt to pull a remote image first. Fetch(ctx context.Context, name string, options image.FetchOptions) (imgutil.Image, error) - // CheckReadAccess verifies if an image accessible with read permissions + // CheckReadAccess verifies if an image is accessible with read permissions // When FetchOptions.Daemon is true and the image doesn't exist in the daemon, - // the behavior is dictated by the pullPolicy, which can have the following behavior + // the behavior is dictated by the pull policy, which can have the following behavior // - PullNever: returns false - // - PullAlways Or PullIfNotPResent: it will check read access for the remote image. + // - PullAlways Or PullIfNotPresent: it will check read access for the remote image. // When FetchOptions.Daemon is false it will check read access for the remote image. CheckReadAccess(repo string, options image.FetchOptions) bool } diff --git a/pkg/client/client.go b/pkg/client/client.go index fe8ebbd8a9..7dd899b20a 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -55,9 +55,9 @@ type ImageFetcher interface { // CheckReadAccess verifies if an image is accessible with read permissions // When FetchOptions.Daemon is true and the image doesn't exist in the daemon, - // the behavior is dictated by the pullPolicy, which can have the following behavior + // the behavior is dictated by the pull policy, which can have the following behavior // - PullNever: returns false - // - PullAlways Or PullIfNotPResent: it will check read access for the remote image. + // - PullAlways Or PullIfNotPresent: it will check read access for the remote image. // When FetchOptions.Daemon is false it will check read access for the remote image. CheckReadAccess(repo string, options image.FetchOptions) bool } diff --git a/pkg/image/fetcher.go b/pkg/image/fetcher.go index aa6a1b7200..40c92b0f45 100644 --- a/pkg/image/fetcher.go +++ b/pkg/image/fetcher.go @@ -130,17 +130,16 @@ func (f *Fetcher) CheckReadAccess(repo string, options FetchOptions) bool { if _, err := f.fetchDaemonImage(repo); err != nil { if errors.Is(err, ErrNotFound) { // Image doesn't exist in the daemon - // Pull Never: should failed + // Pull Never: should fail // Pull If Not Present: need to check the registry if options.PullPolicy == PullNever { return false } return f.checkRemoteReadAccess(repo) } - f.logger.Debugf("failed reading image from the daemon %s, error: %s", repo, err.Error()) + f.logger.Debugf("failed reading image %s from the daemon, error: %s", repo, err.Error()) return false } - // no-op return true }