diff --git a/controllers/ocirepository_controller.go b/controllers/ocirepository_controller.go index b05c5e8b3..4ae80ee00 100644 --- a/controllers/ocirepository_controller.go +++ b/controllers/ocirepository_controller.go @@ -672,7 +672,14 @@ func oidcAuth(ctx context.Context, url, provider string) (authn.Authenticator, e opts.GcpAutoLogin = true } - return login.NewManager().Login(ctx, u, ref, opts) + authenticator, err := login.NewManager().Login(ctx, u, ref, opts) + if err != nil { + return nil, err + } else if authenticator == nil { + return nil, fmt.Errorf("could not authenticate to OCI provider %s with URL %s", provider, url) + } + + return authenticator, nil } // craneOptions sets the auth headers, timeout and user agent