Merge pull request #1629 from mtrmac/ManifestListData-no-deps
Move libimage.ManifestList{Descriptor,Data} to libimage/define
This commit is contained in:
commit
d24aa07e87
|
|
@ -0,0 +1,27 @@
|
|||
package define
|
||||
|
||||
import (
|
||||
"github.com/containers/image/v5/manifest"
|
||||
)
|
||||
|
||||
// ManifestListDescriptor references a platform-specific manifest.
|
||||
// Contains exclusive field like `annotations` which is only present in
|
||||
// OCI spec and not in docker image spec.
|
||||
type ManifestListDescriptor struct {
|
||||
manifest.Schema2Descriptor
|
||||
Platform manifest.Schema2PlatformSpec `json:"platform"`
|
||||
// Annotations contains arbitrary metadata for the image index.
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
}
|
||||
|
||||
// ManifestListData is a list of platform-specific manifests, specifically used to
|
||||
// generate output struct for `podman manifest inspect`. Reason for maintaining and
|
||||
// having this type is to ensure we can have a common type which contains exclusive
|
||||
// fields from both Docker manifest format and OCI manifest format.
|
||||
type ManifestListData struct {
|
||||
SchemaVersion int `json:"schemaVersion"`
|
||||
MediaType string `json:"mediaType"`
|
||||
Manifests []ManifestListDescriptor `json:"manifests"`
|
||||
// Annotations contains arbitrary metadata for the image index.
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/containers/common/libimage/define"
|
||||
"github.com/containers/common/libimage/manifests"
|
||||
imageCopy "github.com/containers/image/v5/copy"
|
||||
"github.com/containers/image/v5/docker"
|
||||
|
|
@ -40,28 +41,6 @@ type ManifestList struct {
|
|||
list manifests.List
|
||||
}
|
||||
|
||||
// ManifestListDescriptor references a platform-specific manifest.
|
||||
// Contains exclusive field like `annotations` which is only present in
|
||||
// OCI spec and not in docker image spec.
|
||||
type ManifestListDescriptor struct {
|
||||
manifest.Schema2Descriptor
|
||||
Platform manifest.Schema2PlatformSpec `json:"platform"`
|
||||
// Annotations contains arbitrary metadata for the image index.
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
}
|
||||
|
||||
// ManifestListData is a list of platform-specific manifests, specifically used to
|
||||
// generate output struct for `podman manifest inspect`. Reason for maintaining and
|
||||
// having this type is to ensure we can have a common type which contains exclusive
|
||||
// fields from both Docker manifest format and OCI manifest format.
|
||||
type ManifestListData struct {
|
||||
SchemaVersion int `json:"schemaVersion"`
|
||||
MediaType string `json:"mediaType"`
|
||||
Manifests []ManifestListDescriptor `json:"manifests"`
|
||||
// Annotations contains arbitrary metadata for the image index.
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
}
|
||||
|
||||
// ID returns the ID of the manifest list.
|
||||
func (m *ManifestList) ID() string {
|
||||
return m.image.ID()
|
||||
|
|
@ -238,8 +217,8 @@ func (i *Image) IsManifestList(ctx context.Context) (bool, error) {
|
|||
}
|
||||
|
||||
// Inspect returns a dockerized version of the manifest list.
|
||||
func (m *ManifestList) Inspect() (*ManifestListData, error) {
|
||||
inspectList := ManifestListData{}
|
||||
func (m *ManifestList) Inspect() (*define.ManifestListData, error) {
|
||||
inspectList := define.ManifestListData{}
|
||||
dockerFormat := m.list.Docker()
|
||||
err := structcopier.Copy(&inspectList, &dockerFormat)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue