Merge pull request #1250 from awesomenix/fixemptyauth
fix: support empty auth config for anonymous registry
This commit is contained in:
commit
567cd57f5f
@ -187,7 +187,8 @@ func ParseAuth(auth *runtime.AuthConfig, host string) (string, string, error) {
|
||||
return user, strings.Trim(passwd, "\x00"), nil
|
||||
}
|
||||
// TODO(random-liu): Support RegistryToken.
|
||||
return "", "", errors.New("invalid auth config")
|
||||
// An empty auth config is valid for anonymous registry
|
||||
return "", "", nil
|
||||
}
|
||||
|
||||
// createImageReference creates image reference inside containerd image store.
|
||||
|
@ -42,9 +42,9 @@ func TestParseAuth(t *testing.T) {
|
||||
expectErr bool
|
||||
}{
|
||||
"should not return error if auth config is nil": {},
|
||||
"should return error if no supported auth is provided": {
|
||||
"should not return error if empty auth is provided for access to anonymous registry": {
|
||||
auth: &runtime.AuthConfig{},
|
||||
expectErr: true,
|
||||
expectErr: false,
|
||||
},
|
||||
"should support identity token": {
|
||||
auth: &runtime.AuthConfig{IdentityToken: "abcd"},
|
||||
|
Loading…
Reference in New Issue
Block a user