Skip to content

Commit cbdafff

Browse files
Support multi-arch image manifests for image digest in buf beta registry plugin push (#4231)
1 parent ed80061 commit cbdafff

File tree

1 file changed

+3
-8
lines changed
  • cmd/buf/internal/command/beta/registry/plugin/pluginpush

1 file changed

+3
-8
lines changed

cmd/buf/internal/command/beta/registry/plugin/pluginpush/pluginpush.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -495,19 +495,14 @@ func getImageIDAndDigestFromReference(
495495
break
496496
}
497497
}
498-
refNameWithoutDigest, _, ok := strings.Cut(ref.Name(), "@")
499-
if !ok {
500-
return "", "", fmt.Errorf("failed to parse reference name %q", ref)
501-
}
502-
repository, err := name.NewRepository(refNameWithoutDigest)
503-
if err != nil {
504-
return "", "", fmt.Errorf("failed to construct repository %q: %w", refNameWithoutDigest, err)
498+
if manifest.Digest.String() == "" {
499+
return "", "", fmt.Errorf("no valid platform manifest found in image index for %q", ref)
505500
}
506501
// We resolved the image index to an image manifest digest, we can now call this function
507502
// again to resolve the image manifest digest to an image config digest.
508503
return getImageIDAndDigestFromReference(
509504
ctx,
510-
repository.Digest(manifest.Digest.String()),
505+
ref.Context().Digest(manifest.Digest.String()),
511506
options...,
512507
)
513508
case desc.MediaType.IsImage():

0 commit comments

Comments
 (0)