Skip to content

Commit

Permalink
Add defaults for GetImageDescriptor and LoadImage.
Browse files Browse the repository at this point in the history
  • Loading branch information
preslavgerchev committed Apr 9, 2024
1 parent 315c363 commit 37fb5db
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions providers/os/connection/container/image/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 37fb5db

Please sign in to comment.