Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 0521a36

Browse files
committed
registry.Auth: try next endpoints on non-auth failures
Allow falling back to non-TLS endpoints if present. Signed-off-by: Sebastiaan van Stijn <[email protected]> Upstream-commit: 80cc1f1d6fb1d03014f7ef5d3a1e216538ddb855 Component: engine
1 parent 742e0e5 commit 0521a36

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

components/engine/registry/service.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,15 @@ func (s *DefaultService) Auth(ctx context.Context, authConfig *types.AuthConfig,
131131
}
132132

133133
for _, endpoint := range endpoints {
134-
return loginV2(authConfig, endpoint, userAgent)
134+
status, token, err = loginV2(authConfig, endpoint, userAgent)
135+
if err == nil {
136+
return
137+
}
138+
if errdefs.IsUnauthorized(err) {
139+
// Failed to authenticate; don't continue with (non-TLS) endpoints.
140+
return status, token, err
141+
}
142+
logrus.WithError(err).Infof("Error logging in to endpoint, trying next endpoint")
135143
}
136144

137145
return "", "", err

0 commit comments

Comments
 (0)