"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/github.com/containers/image/manifest/manifest.go" between
buildah-1.11.2.tar.gz and buildah-1.11.3.tar.gz

About: Buildah is a tool that facilitates building Open Container Initiative (OCI) container images.

manifest.go  (buildah-1.11.2):manifest.go  (buildah-1.11.3)
package manifest package manifest
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/containers/image/types" "github.com/containers/image/v4/types"
"github.com/docker/libtrust" "github.com/containers/libtrust"
"github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1" imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
) )
// FIXME: Should we just use docker/distribution and docker/docker implementatio ns directly? // FIXME: Should we just use docker/distribution and docker/docker implementatio ns directly?
// FIXME(runcom, mitr): should we havea mediatype pkg?? // FIXME(runcom, mitr): should we have a mediatype pkg??
const ( const (
// DockerV2Schema1MediaType MIME type represents Docker manifest schema 1 // DockerV2Schema1MediaType MIME type represents Docker manifest schema 1
DockerV2Schema1MediaType = "application/vnd.docker.distribution.manifest. v1+json" DockerV2Schema1MediaType = "application/vnd.docker.distribution.manifest. v1+json"
// DockerV2Schema1MediaType MIME type represents Docker manifest schema 1 with a JWS signature // DockerV2Schema1MediaType MIME type represents Docker manifest schema 1 with a JWS signature
DockerV2Schema1SignedMediaType = "application/vnd.docker.distribution.man ifest.v1+prettyjws" DockerV2Schema1SignedMediaType = "application/vnd.docker.distribution.man ifest.v1+prettyjws"
// DockerV2Schema2MediaType MIME type represents Docker manifest schema 2 // DockerV2Schema2MediaType MIME type represents Docker manifest schema 2
DockerV2Schema2MediaType = "application/vnd.docker.distribution.manifest. v2+json" DockerV2Schema2MediaType = "application/vnd.docker.distribution.manifest. v2+json"
// DockerV2Schema2ConfigMediaType is the MIME type used for schema 2 conf ig blobs. // DockerV2Schema2ConfigMediaType is the MIME type used for schema 2 conf ig blobs.
DockerV2Schema2ConfigMediaType = "application/vnd.docker.container.image. v1+json" DockerV2Schema2ConfigMediaType = "application/vnd.docker.container.image. v1+json"
// DockerV2Schema2LayerMediaType is the MIME type used for schema 2 layer s. // DockerV2Schema2LayerMediaType is the MIME type used for schema 2 layer s.
DockerV2Schema2LayerMediaType = "application/vnd.docker.image.rootfs.diff .tar.gzip" DockerV2Schema2LayerMediaType = "application/vnd.docker.image.rootfs.diff .tar.gzip"
// DockerV2SchemaLayerMediaTypeUncompressed is the mediaType used for unc
ompressed layers.
DockerV2SchemaLayerMediaTypeUncompressed = "application/vnd.docker.image.
rootfs.diff.tar"
// DockerV2ListMediaType MIME type represents Docker manifest schema 2 li st // DockerV2ListMediaType MIME type represents Docker manifest schema 2 li st
DockerV2ListMediaType = "application/vnd.docker.distribution.manifest.lis t.v2+json" DockerV2ListMediaType = "application/vnd.docker.distribution.manifest.lis t.v2+json"
// DockerV2Schema2ForeignLayerMediaType is the MIME type used for schema 2 foreign layers. // DockerV2Schema2ForeignLayerMediaType is the MIME type used for schema 2 foreign layers.
DockerV2Schema2ForeignLayerMediaType = "application/vnd.docker.image.root DockerV2Schema2ForeignLayerMediaType = "application/vnd.docker.image.root
fs.foreign.diff.tar.gzip" fs.foreign.diff.tar"
// DockerV2Schema2ForeignLayerMediaType is the MIME type used for gzipppe
d schema 2 foreign layers.
DockerV2Schema2ForeignLayerMediaTypeGzip = "application/vnd.docker.image.
rootfs.foreign.diff.tar.gzip"
) )
// SupportedSchema2MediaType checks if the specified string is a supported Docke
r v2s2 media type.
func SupportedSchema2MediaType(m string) error {
switch m {
case DockerV2ListMediaType, DockerV2Schema1MediaType, DockerV2Schema1Sign
edMediaType, DockerV2Schema2ConfigMediaType, DockerV2Schema2ForeignLayerMediaTyp
e, DockerV2Schema2ForeignLayerMediaTypeGzip, DockerV2Schema2LayerMediaType, Dock
erV2Schema2MediaType, DockerV2SchemaLayerMediaTypeUncompressed:
return nil
default:
return fmt.Errorf("unsupported docker v2s2 media type: %q", m)
}
}
// DefaultRequestedManifestMIMETypes is a list of MIME types a types.ImageSource // DefaultRequestedManifestMIMETypes is a list of MIME types a types.ImageSource
// should request from the backend unless directed otherwise. // should request from the backend unless directed otherwise.
var DefaultRequestedManifestMIMETypes = []string{ var DefaultRequestedManifestMIMETypes = []string{
imgspecv1.MediaTypeImageManifest, imgspecv1.MediaTypeImageManifest,
DockerV2Schema2MediaType, DockerV2Schema2MediaType,
DockerV2Schema1SignedMediaType, DockerV2Schema1SignedMediaType,
DockerV2Schema1MediaType, DockerV2Schema1MediaType,
DockerV2ListMediaType, DockerV2ListMediaType,
} }
skipping to change at line 116 skipping to change at line 130
} }
return DockerV2Schema1MediaType return DockerV2Schema1MediaType
case 2: case 2:
// best effort to understand if this is an OCI image since mediaT ype // best effort to understand if this is an OCI image since mediaT ype
// isn't in the manifest for OCI anymore // isn't in the manifest for OCI anymore
// for docker v2s2 meta.MediaType should have been set. But given the data, this is our best guess. // for docker v2s2 meta.MediaType should have been set. But given the data, this is our best guess.
ociMan := struct { ociMan := struct {
Config struct { Config struct {
MediaType string `json:"mediaType"` MediaType string `json:"mediaType"`
} `json:"config"` } `json:"config"`
Layers []imgspecv1.Descriptor `json:"layers"`
}{} }{}
if err := json.Unmarshal(manifest, &ociMan); err != nil { if err := json.Unmarshal(manifest, &ociMan); err != nil {
return "" return ""
} }
if ociMan.Config.MediaType == imgspecv1.MediaTypeImageConfig && l en(ociMan.Layers) != 0 { if ociMan.Config.MediaType == imgspecv1.MediaTypeImageConfig {
return imgspecv1.MediaTypeImageManifest return imgspecv1.MediaTypeImageManifest
} }
ociIndex := struct { ociIndex := struct {
Manifests []imgspecv1.Descriptor `json:"manifests"` Manifests []imgspecv1.Descriptor `json:"manifests"`
}{} }{}
if err := json.Unmarshal(manifest, &ociIndex); err != nil { if err := json.Unmarshal(manifest, &ociIndex); err != nil {
return "" return ""
} }
if len(ociIndex.Manifests) != 0 && ociIndex.Manifests[0].MediaTyp e == imgspecv1.MediaTypeImageManifest { if len(ociIndex.Manifests) != 0 && ociIndex.Manifests[0].MediaTyp e == imgspecv1.MediaTypeImageManifest {
return imgspecv1.MediaTypeImageIndex return imgspecv1.MediaTypeImageIndex
 End of changes. 7 change blocks. 
8 lines changed or deleted 29 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)