Skip to content

Commit 6a6545a

Browse files
committed
Use a proper image name for the imported tar image
When an image is imported from tar without an annotation for the image name, we generate a fake one. Make sure it is valid.
1 parent d23f445 commit 6a6545a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

cmd/convertor/builder/content_store_resolver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func NewContentStoreResolverFromTar(ctx context.Context, tarPath string) (*Conte
149149
log.G(ctx).Debugf(" 📁 FOUND IMAGE INDEX: Importing as-is for multi-arch conversion")
150150

151151
// Import the index itself - let the builder handle platform traversal
152-
ref := fmt.Sprintf("imported:%s", manifest.Digest.Encoded()[:12])
152+
ref := fmt.Sprintf("local/imported:%s", manifest.Digest.Encoded()[:12])
153153
if manifest.Annotations != nil {
154154
if name, ok := manifest.Annotations["org.opencontainers.image.ref.name"]; ok {
155155
ref = name
@@ -169,7 +169,7 @@ func NewContentStoreResolverFromTar(ctx context.Context, tarPath string) (*Conte
169169
log.G(ctx).Debugf(" ✅ PROCESSING: Regular container manifest")
170170

171171
// Generate a reference name for the imported image
172-
ref := fmt.Sprintf("imported:%s", manifest.Digest.Encoded()[:12])
172+
ref := fmt.Sprintf("local/imported:%s", manifest.Digest.Encoded()[:12])
173173
if manifest.Annotations != nil {
174174
if name, ok := manifest.Annotations["org.opencontainers.image.ref.name"]; ok {
175175
ref = name

cmd/convertor/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Version: ` + commitID,
150150
for _, img := range images {
151151
// The main index usually has the original tag name (e.g., "latest")
152152
// Platform-specific manifests have names like "latest-linux-amd64"
153-
if !strings.Contains(img.Name, "-linux-") && !strings.Contains(img.Name, "imported:") {
153+
if !strings.Contains(img.Name, "-linux-") && !strings.Contains(img.Name, "local/imported:") {
154154
ref = img.Name
155155
isMultiArch = (img.Target.MediaType == "application/vnd.oci.image.index.v1+json")
156156
break

0 commit comments

Comments
 (0)