From 37fb5db0407ddb16a1cb627e8e46295c4d839508 Mon Sep 17 00:00:00 2001 From: Preslav Date: Tue, 9 Apr 2024 23:06:17 +0300 Subject: [PATCH] Add defaults for GetImageDescriptor and LoadImage. --- providers/os/connection/container/image/registry.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/providers/os/connection/container/image/registry.go b/providers/os/connection/container/image/registry.go index a2d5fcee9b..78145f3388 100644 --- a/providers/os/connection/container/image/registry.go +++ b/providers/os/connection/container/image/registry.go @@ -7,13 +7,20 @@ import ( "github.com/google/go-containerregistry/pkg/name" v1 "github.com/google/go-containerregistry/pkg/v1" "github.com/google/go-containerregistry/pkg/v1/remote" + "go.mondoo.com/cnquery/v10/providers/os/connection/container/auth" ) func GetImageDescriptor(ref name.Reference, opts ...remote.Option) (*remote.Descriptor, error) { + if len(opts) == 0 { + opts = auth.DefaultOpts(ref.Name(), false) + } return remote.Get(ref, opts...) } func LoadImageFromRegistry(ref name.Reference, opts ...remote.Option) (v1.Image, error) { + if len(opts) == 0 { + opts = auth.DefaultOpts(ref.Name(), false) + } img, err := remote.Image(ref, opts...) if err != nil { return nil, err