forked from TrueCloudLab/distribution
Vendor updated version of docker/distribution
This updates the vendored docker/distribution to the current master branch. Note the following changes: - The manifest package was split into manifest/schema1. Most references to the manifest package in the engine needed to be updated to use schema1 instead. - Validation functions in api/v2 were replaced by the distribution/reference package. The engine code has been updated to use the reference package for validation where necessary. A future PR will change the engine to use the types defined in distribution/reference more comprehensively. - The reference package explicitly allows double _ characters in repository names. registry_test.go was updated for this. - TestPullFailsWithAlteredManifest was corrupting the manifest JSON, now that the schema1 package unmarshals the correct payload. The test is being changed to modify the JSON without affecting its length, which allows the pull to succeed to the point where digest validation happens. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
24de26a805
commit
afd61ce8f2
3 changed files with 8 additions and 5 deletions
|
@ -8,7 +8,7 @@ import (
|
|||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/distribution/registry/api/v2"
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/opts"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
|
@ -226,7 +226,8 @@ func validateRemoteName(remoteName string) error {
|
|||
}
|
||||
}
|
||||
|
||||
return v2.ValidateRepositoryName(remoteName)
|
||||
_, err := reference.WithName(remoteName)
|
||||
return err
|
||||
}
|
||||
|
||||
func validateNoSchema(reposName string) error {
|
||||
|
|
|
@ -190,7 +190,7 @@ func addRequiredHeadersToRedirectedRequests(req *http.Request, via []*http.Reque
|
|||
func shouldV2Fallback(err errcode.Error) bool {
|
||||
logrus.Debugf("v2 error: %T %v", err, err)
|
||||
switch err.Code {
|
||||
case v2.ErrorCodeUnauthorized, v2.ErrorCodeManifestUnknown:
|
||||
case errcode.ErrorCodeUnauthorized, v2.ErrorCodeManifestUnknown:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
|
@ -776,6 +776,9 @@ func TestValidRemoteName(t *testing.T) {
|
|||
// single character names are now allowed.
|
||||
"d/docker",
|
||||
"jess/t",
|
||||
|
||||
// Consecutive underscores.
|
||||
"dock__er/docker",
|
||||
}
|
||||
for _, repositoryName := range validRepositoryNames {
|
||||
if err := validateRemoteName(repositoryName); err != nil {
|
||||
|
@ -803,8 +806,7 @@ func TestValidRemoteName(t *testing.T) {
|
|||
|
||||
"_docker/_docker",
|
||||
|
||||
// Disallow consecutive underscores and periods.
|
||||
"dock__er/docker",
|
||||
// Disallow consecutive periods.
|
||||
"dock..er/docker",
|
||||
"dock_.er/docker",
|
||||
"dock-.er/docker",
|
||||
|
|
Loading…
Reference in a new issue