Browse code

Revert "Return no basic auth creds error when needed"

This reverts commit 87775923971f93828610335b272129b33571541e, which
turns out to break other test cases/the registry flow.

The correct place to handle missing credentials is instead
https://github.com/containerd/containerd/blob/15bf23df09f974fe4813dd65eb550763f621fc0b/remotes/docker/authorizer.go#L200.

Co-authored-by: Djordje Lukic <djordje.lukic@docker.com>
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>

Bjorn Neergaard authored on 2023/10/14 02:39:09
Showing 1 changed files
... ...
@@ -11,7 +11,6 @@ import (
11 11
 	"github.com/containerd/containerd/remotes/docker"
12 12
 	"github.com/containerd/containerd/version"
13 13
 	"github.com/containerd/log"
14
-	"github.com/docker/distribution/registry/client/auth"
15 14
 	registrytypes "github.com/docker/docker/api/types/registry"
16 15
 	"github.com/docker/docker/dockerversion"
17 16
 	"github.com/docker/docker/pkg/useragent"
... ...
@@ -76,15 +75,11 @@ func authorizerFromAuthConfig(authConfig registrytypes.AuthConfig) docker.Author
76 76
 				"host":    host,
77 77
 				"cfgHost": cfgHost,
78 78
 			}).Warn("Host doesn't match")
79
-			return "", "", auth.ErrNoBasicAuthCredentials
79
+			return "", "", nil
80 80
 		}
81 81
 		if authConfig.IdentityToken != "" {
82 82
 			return "", authConfig.IdentityToken, nil
83 83
 		}
84
-
85
-		if authConfig.Username == "" && authConfig.Password == "" {
86
-			return "", "", auth.ErrNoBasicAuthCredentials
87
-		}
88 84
 		return authConfig.Username, authConfig.Password, nil
89 85
 	}))
90 86
 }