Merge pull request #25841 from anusha-ragunathan/vendor-dist
Vendor distribution changes.
This commit is contained in:
commit
5b6063c837
|
@ -87,7 +87,7 @@ clone git github.com/boltdb/bolt v1.2.1
|
||||||
clone git github.com/miekg/dns 75e6e86cc601825c5dbcd4e0c209eab180997cd7
|
clone git github.com/miekg/dns 75e6e86cc601825c5dbcd4e0c209eab180997cd7
|
||||||
|
|
||||||
# get graph and distribution packages
|
# get graph and distribution packages
|
||||||
clone git github.com/docker/distribution 07f32ac1831ed0fc71960b7da5d6bb83cb6881b5
|
clone git github.com/docker/distribution 77b9d2997abcded79a5314970fe69a44c93c25fb
|
||||||
clone git github.com/vbatts/tar-split v0.9.11
|
clone git github.com/vbatts/tar-split v0.9.11
|
||||||
|
|
||||||
# get go-zfs packages
|
# get go-zfs packages
|
||||||
|
|
|
@ -3,13 +3,13 @@ FROM golang:1.6-alpine
|
||||||
ENV DISTRIBUTION_DIR /go/src/github.com/docker/distribution
|
ENV DISTRIBUTION_DIR /go/src/github.com/docker/distribution
|
||||||
ENV DOCKER_BUILDTAGS include_oss include_gcs
|
ENV DOCKER_BUILDTAGS include_oss include_gcs
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
&& apk add --no-cache make git
|
||||||
|
|
||||||
WORKDIR $DISTRIBUTION_DIR
|
WORKDIR $DISTRIBUTION_DIR
|
||||||
COPY . $DISTRIBUTION_DIR
|
COPY . $DISTRIBUTION_DIR
|
||||||
COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml
|
COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml
|
||||||
|
|
||||||
RUN set -ex \
|
|
||||||
&& apk add --no-cache make git
|
|
||||||
|
|
||||||
RUN make PREFIX=/go clean binaries
|
RUN make PREFIX=/go clean binaries
|
||||||
|
|
||||||
VOLUME ["/var/lib/registry"]
|
VOLUME ["/var/lib/registry"]
|
||||||
|
|
|
@ -192,6 +192,18 @@ type BlobCreateOption interface {
|
||||||
Apply(interface{}) error
|
Apply(interface{}) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateOptions is a collection of blob creation modifiers relevant to general
|
||||||
|
// blob storage intended to be configured by the BlobCreateOption.Apply method.
|
||||||
|
type CreateOptions struct {
|
||||||
|
Mount struct {
|
||||||
|
ShouldMount bool
|
||||||
|
From reference.Canonical
|
||||||
|
// Stat allows to pass precalculated descriptor to link and return.
|
||||||
|
// Blob access check will be skipped if set.
|
||||||
|
Stat *Descriptor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// BlobWriter provides a handle for inserting data into a blob store.
|
// BlobWriter provides a handle for inserting data into a blob store.
|
||||||
// Instances should be obtained from BlobWriteService.Writer and
|
// Instances should be obtained from BlobWriteService.Writer and
|
||||||
// BlobWriteService.Resume. If supported by the store, a writer can be
|
// BlobWriteService.Resume. If supported by the store, a writer can be
|
||||||
|
|
|
@ -49,9 +49,10 @@ test:
|
||||||
# - gvm use old && go version
|
# - gvm use old && go version
|
||||||
- gvm use stable && go version
|
- gvm use stable && go version
|
||||||
|
|
||||||
|
# todo(richard): replace with a more robust vendoring solution. Removed due to a fundamental disagreement in godep philosophies.
|
||||||
# Ensure validation of dependencies
|
# Ensure validation of dependencies
|
||||||
- gvm use stable && if test -n "`git diff --stat=1000 master | grep -Ei \"vendor|godeps\"`"; then make dep-validate; fi:
|
# - gvm use stable && if test -n "`git diff --stat=1000 master | grep -Ei \"vendor|godeps\"`"; then make dep-validate; fi:
|
||||||
pwd: $BASE_STABLE
|
# pwd: $BASE_STABLE
|
||||||
|
|
||||||
# First thing: build everything. This will catch compile errors, and it's
|
# First thing: build everything. This will catch compile errors, and it's
|
||||||
# also necessary for go vet to work properly (see #807).
|
# also necessary for go vet to work properly (see #807).
|
||||||
|
@ -73,7 +74,7 @@ test:
|
||||||
override:
|
override:
|
||||||
# Test stable, and report
|
# Test stable, and report
|
||||||
- gvm use stable; export ROOT_PACKAGE=$(go list .); go list -tags "$DOCKER_BUILDTAGS" ./... | grep -v "/vendor/" | xargs -L 1 -I{} bash -c 'export PACKAGE={}; godep go test -tags "$DOCKER_BUILDTAGS" -test.short -coverprofile=$GOPATH/src/$PACKAGE/coverage.out -coverpkg=$(./coverpkg.sh $PACKAGE $ROOT_PACKAGE) $PACKAGE':
|
- gvm use stable; export ROOT_PACKAGE=$(go list .); go list -tags "$DOCKER_BUILDTAGS" ./... | grep -v "/vendor/" | xargs -L 1 -I{} bash -c 'export PACKAGE={}; godep go test -tags "$DOCKER_BUILDTAGS" -test.short -coverprofile=$GOPATH/src/$PACKAGE/coverage.out -coverpkg=$(./coverpkg.sh $PACKAGE $ROOT_PACKAGE) $PACKAGE':
|
||||||
timeout: 600
|
timeout: 1000
|
||||||
pwd: $BASE_STABLE
|
pwd: $BASE_STABLE
|
||||||
|
|
||||||
post:
|
post:
|
||||||
|
|
|
@ -103,20 +103,22 @@ func GetRequestID(ctx Context) string {
|
||||||
// WithResponseWriter returns a new context and response writer that makes
|
// WithResponseWriter returns a new context and response writer that makes
|
||||||
// interesting response statistics available within the context.
|
// interesting response statistics available within the context.
|
||||||
func WithResponseWriter(ctx Context, w http.ResponseWriter) (Context, http.ResponseWriter) {
|
func WithResponseWriter(ctx Context, w http.ResponseWriter) (Context, http.ResponseWriter) {
|
||||||
irw := instrumentedResponseWriter{
|
|
||||||
ResponseWriter: w,
|
|
||||||
Context: ctx,
|
|
||||||
}
|
|
||||||
|
|
||||||
if closeNotifier, ok := w.(http.CloseNotifier); ok {
|
if closeNotifier, ok := w.(http.CloseNotifier); ok {
|
||||||
irwCN := &instrumentedResponseWriterCN{
|
irwCN := &instrumentedResponseWriterCN{
|
||||||
instrumentedResponseWriter: irw,
|
instrumentedResponseWriter: instrumentedResponseWriter{
|
||||||
|
ResponseWriter: w,
|
||||||
|
Context: ctx,
|
||||||
|
},
|
||||||
CloseNotifier: closeNotifier,
|
CloseNotifier: closeNotifier,
|
||||||
}
|
}
|
||||||
|
|
||||||
return irwCN, irwCN
|
return irwCN, irwCN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
irw := instrumentedResponseWriter{
|
||||||
|
ResponseWriter: w,
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
return &irw, &irw
|
return &irw, &irw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,9 @@ const (
|
||||||
// MediaTypeConfig specifies the mediaType for the image configuration.
|
// MediaTypeConfig specifies the mediaType for the image configuration.
|
||||||
MediaTypeConfig = "application/vnd.docker.container.image.v1+json"
|
MediaTypeConfig = "application/vnd.docker.container.image.v1+json"
|
||||||
|
|
||||||
|
// MediaTypePluginConfig specifies the mediaType for plugin configuration.
|
||||||
|
MediaTypePluginConfig = "application/vnd.docker.plugin.v0+json"
|
||||||
|
|
||||||
// MediaTypeLayer is the mediaType used for layers referenced by the
|
// MediaTypeLayer is the mediaType used for layers referenced by the
|
||||||
// manifest.
|
// manifest.
|
||||||
MediaTypeLayer = "application/vnd.docker.image.rootfs.diff.tar.gzip"
|
MediaTypeLayer = "application/vnd.docker.image.rootfs.diff.tar.gzip"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package manifest
|
package manifest
|
||||||
|
|
||||||
// Versioned provides a struct with the manifest schemaVersion and . Incoming
|
// Versioned provides a struct with the manifest schemaVersion and mediaType.
|
||||||
// content with unknown schema version can be decoded against this struct to
|
// Incoming content with unknown schema version can be decoded against this
|
||||||
// check the version.
|
// struct to check the version.
|
||||||
type Versioned struct {
|
type Versioned struct {
|
||||||
// SchemaVersion is the image manifest schema that this image follows
|
// SchemaVersion is the image manifest schema that this image follows
|
||||||
SchemaVersion int `json:"schemaVersion"`
|
SchemaVersion int `json:"schemaVersion"`
|
||||||
|
|
|
@ -175,6 +175,27 @@ var (
|
||||||
errcode.ErrorCodeDenied,
|
errcode.ErrorCodeDenied,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tooManyRequestsDescriptor = ResponseDescriptor{
|
||||||
|
Name: "Too Many Requests",
|
||||||
|
StatusCode: http.StatusTooManyRequests,
|
||||||
|
Description: "The client made too many requests within a time interval.",
|
||||||
|
Headers: []ParameterDescriptor{
|
||||||
|
{
|
||||||
|
Name: "Content-Length",
|
||||||
|
Type: "integer",
|
||||||
|
Description: "Length of the JSON response body.",
|
||||||
|
Format: "<length>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Body: BodyDescriptor{
|
||||||
|
ContentType: "application/json; charset=utf-8",
|
||||||
|
Format: errorsBody,
|
||||||
|
},
|
||||||
|
ErrorCodes: []errcode.ErrorCode{
|
||||||
|
errcode.ErrorCodeTooManyRequests,
|
||||||
|
},
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -202,17 +223,6 @@ const (
|
||||||
...
|
...
|
||||||
]
|
]
|
||||||
}`
|
}`
|
||||||
|
|
||||||
unauthorizedErrorsBody = `{
|
|
||||||
"errors:" [
|
|
||||||
{
|
|
||||||
"code": "UNAUTHORIZED",
|
|
||||||
"message": "access to the requested resource is not authorized",
|
|
||||||
"detail": ...
|
|
||||||
},
|
|
||||||
...
|
|
||||||
]
|
|
||||||
}`
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// APIDescriptor exports descriptions of the layout of the v2 registry API.
|
// APIDescriptor exports descriptions of the layout of the v2 registry API.
|
||||||
|
@ -391,6 +401,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
StatusCode: http.StatusNotFound,
|
StatusCode: http.StatusNotFound,
|
||||||
},
|
},
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -445,6 +456,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -481,6 +493,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -535,6 +548,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -592,6 +606,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
{
|
{
|
||||||
Name: "Missing Layer(s)",
|
Name: "Missing Layer(s)",
|
||||||
Description: "One or more layers may be missing during a manifest upload. If so, the missing layers will be enumerated in the error response.",
|
Description: "One or more layers may be missing during a manifest upload. If so, the missing layers will be enumerated in the error response.",
|
||||||
|
@ -661,6 +676,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
{
|
{
|
||||||
Name: "Unknown Manifest",
|
Name: "Unknown Manifest",
|
||||||
Description: "The specified `name` or `reference` are unknown to the registry and the delete was unable to proceed. Clients can assume the manifest was already deleted if this response is returned.",
|
Description: "The specified `name` or `reference` are unknown to the registry and the delete was unable to proceed. Clients can assume the manifest was already deleted if this response is returned.",
|
||||||
|
@ -769,6 +785,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -843,6 +860,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -909,6 +927,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -993,6 +1012,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1039,6 +1059,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1103,6 +1124,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1175,6 +1197,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1249,6 +1272,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1334,6 +1358,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1424,6 +1449,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1480,6 +1506,7 @@ var routeDescriptors = []RouteDescriptor{
|
||||||
unauthorizedResponseDescriptor,
|
unauthorizedResponseDescriptor,
|
||||||
repositoryNotFoundResponseDescriptor,
|
repositoryNotFoundResponseDescriptor,
|
||||||
deniedResponseDescriptor,
|
deniedResponseDescriptor,
|
||||||
|
tooManyRequestsDescriptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -680,15 +680,6 @@ func (bs *blobs) Put(ctx context.Context, mediaType string, p []byte) (distribut
|
||||||
return writer.Commit(ctx, desc)
|
return writer.Commit(ctx, desc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// createOptions is a collection of blob creation modifiers relevant to general
|
|
||||||
// blob storage intended to be configured by the BlobCreateOption.Apply method.
|
|
||||||
type createOptions struct {
|
|
||||||
Mount struct {
|
|
||||||
ShouldMount bool
|
|
||||||
From reference.Canonical
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type optionFunc func(interface{}) error
|
type optionFunc func(interface{}) error
|
||||||
|
|
||||||
func (f optionFunc) Apply(v interface{}) error {
|
func (f optionFunc) Apply(v interface{}) error {
|
||||||
|
@ -699,7 +690,7 @@ func (f optionFunc) Apply(v interface{}) error {
|
||||||
// mounted from the given canonical reference.
|
// mounted from the given canonical reference.
|
||||||
func WithMountFrom(ref reference.Canonical) distribution.BlobCreateOption {
|
func WithMountFrom(ref reference.Canonical) distribution.BlobCreateOption {
|
||||||
return optionFunc(func(v interface{}) error {
|
return optionFunc(func(v interface{}) error {
|
||||||
opts, ok := v.(*createOptions)
|
opts, ok := v.(*distribution.CreateOptions)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("unexpected options type: %T", v)
|
return fmt.Errorf("unexpected options type: %T", v)
|
||||||
}
|
}
|
||||||
|
@ -712,7 +703,7 @@ func WithMountFrom(ref reference.Canonical) distribution.BlobCreateOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bs *blobs) Create(ctx context.Context, options ...distribution.BlobCreateOption) (distribution.BlobWriter, error) {
|
func (bs *blobs) Create(ctx context.Context, options ...distribution.BlobCreateOption) (distribution.BlobWriter, error) {
|
||||||
var opts createOptions
|
var opts distribution.CreateOptions
|
||||||
|
|
||||||
for _, option := range options {
|
for _, option := range options {
|
||||||
err := option.Apply(&opts)
|
err := option.Apply(&opts)
|
||||||
|
|
Loading…
Reference in New Issue