Skip to content

Commit

Permalink
Merge pull request moby#48701 from thaJeztah/keep_manifest_order
Browse files Browse the repository at this point in the history
api: GET /images/json: preserve original manifest order
  • Loading branch information
thaJeztah authored Oct 21, 2024
2 parents 5039225 + d122ea0 commit e038410
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 1 addition & 7 deletions daemon/containerd/image_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,7 @@ func (i *ImageService) imageSummary(ctx context.Context, img images.Image, platf

if opts.Manifests {
defer func() {
// If the platform is available, prepend it to the list of platforms
// otherwise append it at the end.
if available {
manifestSummaries = append([]imagetypes.ManifestSummary{mfstSummary}, manifestSummaries...)
} else {
manifestSummaries = append(manifestSummaries, mfstSummary)
}
manifestSummaries = append(manifestSummaries, mfstSummary)
}()
}

Expand Down
4 changes: 2 additions & 2 deletions daemon/containerd/image_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ func TestImageList(t *testing.T) {

assert.Check(t, is.Equal(i.Manifests[0].Kind, imagetypes.ManifestKindImage))
if assert.Check(t, i.Manifests[0].ImageData != nil) {
assert.Check(t, is.Equal(i.Manifests[0].ImageData.Platform.Architecture, "arm64"))
assert.Check(t, is.Equal(i.Manifests[0].ImageData.Platform.Architecture, "amd64"))
}
assert.Check(t, is.Equal(i.Manifests[1].Kind, imagetypes.ManifestKindImage))
if assert.Check(t, i.Manifests[1].ImageData != nil) {
assert.Check(t, is.Equal(i.Manifests[1].ImageData.Platform.Architecture, "amd64"))
assert.Check(t, is.Equal(i.Manifests[1].ImageData.Platform.Architecture, "arm64"))
}
},
},
Expand Down

0 comments on commit e038410

Please sign in to comment.