Skip to content

Commit

Permalink
image: fix image.Manifest compatibility for checkpoint image
Browse files Browse the repository at this point in the history
Signed-off-by: jerryzhuang <zhuangqhc@gmail.com>
  • Loading branch information
zhuangqh committed Sep 11, 2023
1 parent d015c99 commit c943064
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ func (c *container) Checkpoint(ctx context.Context, ref string, opts ...Checkpoi
Versioned: ver.Versioned{
SchemaVersion: 2,
},
MediaType: ocispec.MediaTypeImageIndex,
Annotations: make(map[string]string),
}
copts := &options.CheckpointOptions{
Expand Down
5 changes: 4 additions & 1 deletion images/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ func Manifest(ctx context.Context, provider content.Provider, image ocispec.Desc

var descs []ocispec.Descriptor
for _, d := range idx.Manifests {
if !IsManifestType(d.MediaType) {
continue
}
if d.Platform == nil || platform.Match(*d.Platform) {
descs = append(descs, d)
}
Expand All @@ -229,7 +232,7 @@ func Manifest(ctx context.Context, provider content.Provider, image ocispec.Desc
}
return descs, nil
}
return nil, fmt.Errorf("unexpected media type %v for %v: %w", desc.MediaType, desc.Digest, errdefs.ErrNotFound)
return nil, ErrSkipDesc
}), image); err != nil {
return ocispec.Manifest{}, err
}
Expand Down
1 change: 1 addition & 0 deletions task.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointTaskOpts) (Imag
Versioned: is.Versioned{
SchemaVersion: 2,
},
MediaType: v1.MediaTypeImageIndex,
Annotations: make(map[string]string),
}
if err := t.checkpointTask(ctx, &index, request); err != nil {
Expand Down

0 comments on commit c943064

Please sign in to comment.