Browse code

Vendor updated docker/distribution package

Fixes #19400

Note that this introduces an incompatibility with Docker 1.10-rc1,
because the media type used for schema1 manifests has been corrected in
the upstream distribution code. Docker 1.10-rc1 won't be able to pull
old manifests from Registry 2.3-rc0 and up, but because of this vendor
update, Docker 1.10-rc2 won't have this problem.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>

Aaron Lehmann authored on 2016/01/20 06:28:51
Showing 5 changed files
... ...
@@ -155,7 +155,7 @@ RUN set -x \
155 155
 # both. This allows integration-cli tests to cover push/pull with both schema1
156 156
 # and schema2 manifests.
157 157
 ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd
158
-ENV REGISTRY_COMMIT cb08de17d74bef86ce6c5abe8b240e282f5750be
158
+ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827
159 159
 RUN set -x \
160 160
 	&& export GOPATH="$(mktemp -d)" \
161 161
 	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
... ...
@@ -46,7 +46,7 @@ clone git github.com/boltdb/bolt v1.1.0
46 46
 clone git github.com/miekg/dns 75e6e86cc601825c5dbcd4e0c209eab180997cd7
47 47
 
48 48
 # get graph and distribution packages
49
-clone git github.com/docker/distribution cb08de17d74bef86ce6c5abe8b240e282f5750be
49
+clone git github.com/docker/distribution 47a064d4195a9b56133891bbb13620c3ac83a827
50 50
 clone git github.com/vbatts/tar-split v0.9.11
51 51
 
52 52
 # get desired notary commit, might also need to be updated in Dockerfile
... ...
@@ -1,4 +1,4 @@
1
-FROM golang:1.5.2
1
+FROM golang:1.5.3
2 2
 
3 3
 RUN apt-get update && \
4 4
     apt-get install -y librados-dev apache2-utils && \
... ...
@@ -39,11 +39,11 @@ func init() {
39 39
 		desc := distribution.Descriptor{
40 40
 			Digest:    digest.FromBytes(sm.Canonical),
41 41
 			Size:      int64(len(sm.Canonical)),
42
-			MediaType: MediaTypeManifest,
42
+			MediaType: MediaTypeSignedManifest,
43 43
 		}
44 44
 		return sm, desc, err
45 45
 	}
46
-	err := distribution.RegisterManifestSchema(MediaTypeManifest, schema1Func)
46
+	err := distribution.RegisterManifestSchema(MediaTypeSignedManifest, schema1Func)
47 47
 	if err != nil {
48 48
 		panic(fmt.Sprintf("Unable to register manifest: %s", err))
49 49
 	}
... ...
@@ -51,7 +51,7 @@ func init() {
51 51
 	if err != nil {
52 52
 		panic(fmt.Sprintf("Unable to register manifest: %s", err))
53 53
 	}
54
-	err = distribution.RegisterManifestSchema("application/json; charset=utf-8", schema1Func)
54
+	err = distribution.RegisterManifestSchema("application/json", schema1Func)
55 55
 	if err != nil {
56 56
 		panic(fmt.Sprintf("Unable to register manifest: %s", err))
57 57
 	}
... ...
@@ -167,7 +167,7 @@ func (sm *SignedManifest) MarshalJSON() ([]byte, error) {
167 167
 
168 168
 // Payload returns the signed content of the signed manifest.
169 169
 func (sm SignedManifest) Payload() (string, []byte, error) {
170
-	return MediaTypeManifest, sm.all, nil
170
+	return MediaTypeSignedManifest, sm.all, nil
171 171
 }
172 172
 
173 173
 // Signatures returns the signatures as provided by
... ...
@@ -2,6 +2,7 @@ package distribution
2 2
 
3 3
 import (
4 4
 	"fmt"
5
+	"strings"
5 6
 
6 7
 	"github.com/docker/distribution/context"
7 8
 	"github.com/docker/distribution/digest"
... ...
@@ -80,7 +81,17 @@ var mappings = make(map[string]UnmarshalFunc, 0)
80 80
 
81 81
 // UnmarshalManifest looks up manifest unmarshall functions based on
82 82
 // MediaType
83
-func UnmarshalManifest(mediatype string, p []byte) (Manifest, Descriptor, error) {
83
+func UnmarshalManifest(ctHeader string, p []byte) (Manifest, Descriptor, error) {
84
+	// Need to look up by the actual content type, not the raw contents of
85
+	// the header. Strip semicolons and anything following them.
86
+	var mediatype string
87
+	semicolonIndex := strings.Index(ctHeader, ";")
88
+	if semicolonIndex != -1 {
89
+		mediatype = ctHeader[:semicolonIndex]
90
+	} else {
91
+		mediatype = ctHeader
92
+	}
93
+
84 94
 	unmarshalFunc, ok := mappings[mediatype]
85 95
 	if !ok {
86 96
 		return nil, Descriptor{}, fmt.Errorf("unsupported manifest mediatype: %s", mediatype)