Merge pull request #417 from mtrmac/manifest-list-hofix

Vendor in mtrmac/image:manifest-list-hotfix
This commit is contained in:
Miloslav Trmač 2017-09-14 17:41:55 +02:00 committed by GitHub
commit 875dd2e7a9
5 changed files with 12 additions and 18 deletions

View File

@ -90,6 +90,7 @@ func (s *CopySuite) TearDownSuite(c *check.C) {
} }
func (s *CopySuite) TestCopyFailsWithManifestList(c *check.C) { func (s *CopySuite) TestCopyFailsWithManifestList(c *check.C) {
c.ExpectFailure("manifest-list-hotfix sacrificed hotfixes for being able to copy images")
assertSkopeoFails(c, ".*can not copy docker://estesp/busybox:latest: manifest contains multiple images.*", "copy", "docker://estesp/busybox:latest", "dir:somedir") assertSkopeoFails(c, ".*can not copy docker://estesp/busybox:latest: manifest contains multiple images.*", "copy", "docker://estesp/busybox:latest", "dir:somedir")
} }

View File

@ -35,7 +35,7 @@ var DefaultRequestedManifestMIMETypes = []string{
DockerV2Schema2MediaType, DockerV2Schema2MediaType,
DockerV2Schema1SignedMediaType, DockerV2Schema1SignedMediaType,
DockerV2Schema1MediaType, DockerV2Schema1MediaType,
DockerV2ListMediaType, // DockerV2ListMediaType, // FIXME: Restore this ASAP
} }
// GuessMIMEType guesses MIME type of a manifest and returns it _if it is recognized_, or "" if unknown or unrecognized. // GuessMIMEType guesses MIME type of a manifest and returns it _if it is recognized_, or "" if unknown or unrecognized.

View File

@ -153,7 +153,7 @@ func fixFiles(dir string, usermode bool) error {
if err != nil { if err != nil {
return err return err
} }
} else if usermode && (info.Mode().IsRegular() || (info.Mode()&os.ModeSymlink) != 0) { } else if usermode && (info.Mode().IsRegular()) {
if err := os.Chmod(fullpath, info.Mode()|0600); err != nil { if err := os.Chmod(fullpath, info.Mode()|0600); err != nil {
return err return err
} }

View File

@ -84,24 +84,15 @@ func NewReference(image string, repo string) (types.ImageReference, error) {
// image is not _really_ in a containers/image/docker/reference format; // image is not _really_ in a containers/image/docker/reference format;
// as far as the libOSTree ociimage/* namespace is concerned, it is more or // as far as the libOSTree ociimage/* namespace is concerned, it is more or
// less an arbitrary string with an implied tag. // less an arbitrary string with an implied tag.
// We use the reference.* parsers basically for the default tag name in // Parse the image using reference.ParseNormalizedNamed so that we can
// reference.TagNameOnly, and incidentally for some character set and length // check whether the images has a tag specified and we can add ":latest" if needed
// restrictions. ostreeImage, err := reference.ParseNormalizedNamed(image)
var ostreeImage reference.Named
s := strings.SplitN(image, ":", 2)
named, err := reference.WithName(s[0])
if err != nil { if err != nil {
return nil, err return nil, err
} }
if len(s) == 1 { if reference.IsNameOnly(ostreeImage) {
ostreeImage = reference.TagNameOnly(named) image = image + ":latest"
} else {
ostreeImage, err = reference.WithTag(named, s[1])
if err != nil {
return nil, err
}
} }
resolved, err := explicitfilepath.ResolvePathToFullyExplicit(repo) resolved, err := explicitfilepath.ResolvePathToFullyExplicit(repo)
@ -123,8 +114,8 @@ func NewReference(image string, repo string) (types.ImageReference, error) {
} }
return ostreeReference{ return ostreeReference{
image: ostreeImage.String(), image: image,
branchName: encodeOStreeRef(ostreeImage.String()), branchName: encodeOStreeRef(image),
repo: resolved, repo: resolved,
}, nil }, nil
} }

View File

@ -302,6 +302,8 @@ type SystemContext struct {
SignaturePolicyPath string SignaturePolicyPath string
// If not "", overrides the system's default path for registries.d (Docker signature storage configuration) // If not "", overrides the system's default path for registries.d (Docker signature storage configuration)
RegistriesDirPath string RegistriesDirPath string
// Path to the system-wide registries configuration file
SystemRegistriesConfPath string
// === docker.Transport overrides === // === docker.Transport overrides ===
// If not "", a directory containing a CA certificate (ending with ".crt"), // If not "", a directory containing a CA certificate (ending with ".crt"),