Skip to content

Commit

Permalink
fix: use registry for inspection
Browse files Browse the repository at this point in the history
  • Loading branch information
vsukhin committed Mar 25, 2024
1 parent de6310c commit fcc4fb6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/imageinspector/skopeofetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (s *skopeoFetcher) Fetch(ctx context.Context, registry, image string, pullS
if err != nil {
return nil, err
}
info, err := client.Inspect(image) // TODO: Support passing context
info, err := client.Inspect(registry, image) // TODO: Support passing context
if err != nil {
return nil, err
}
Expand Down
11 changes: 8 additions & 3 deletions pkg/skopeo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type DockerImage struct {

// Inspector is image inspector interface
type Inspector interface {
Inspect(image string) (*DockerImage, error)
Inspect(registry, image string) (*DockerImage, error)
}

type client struct {
Expand All @@ -77,7 +77,7 @@ func NewClientFromSecrets(imageSecrets []corev1.Secret, registry string) (*clien
}

// Inspect inspect a docker image
func (c *client) Inspect(image string) (*DockerImage, error) {
func (c *client) Inspect(registry, image string) (*DockerImage, error) {
args := []string{
"--override-os",
"linux",
Expand All @@ -89,7 +89,12 @@ func (c *client) Inspect(image string) (*DockerImage, error) {
args = append(args, "--creds", c.dockerAuthConfigs[i].Username+":"+c.dockerAuthConfigs[i].Password)
}

args = append(args, "--config", "docker://"+image)
config := "docker://" + image
if registry != "" {
config = registry + "/" + image
}

args = append(args, "--config", config)
result, err := process.Execute("skopeo", args...)
if err != nil {
return nil, err
Expand Down

0 comments on commit fcc4fb6

Please sign in to comment.