mirror of
https://github.com/docker/compose.git
synced 2026-10-12 02:13:08 +00:00
fix(registry): use the https://dhi.io credentials key
Docker Desktop stores Docker Hardened Images credentials under https://dhi.io, so return that as the server address of dhi.io credentials, as StagingIndexServer does for the staging registry. Signed-off-by: Alano Terblanche <[email protected]>
This commit is contained in:
committed by
Nicolas De loof
parent
81b6b59e79
commit
e22de3b574
@@ -104,7 +104,7 @@ func (p *desktopAuthProvider) GetAuthConfig(registryHostname string) (clitypes.A
|
||||
if session := p.sessionFor(registryHostname); session != nil {
|
||||
if auth, ok := session.auth(); ok {
|
||||
if registryHost(registryHostname) == DHIRegistryHost {
|
||||
auth.ServerAddress = DHIRegistryHost
|
||||
auth.ServerAddress = DHIIndexServer
|
||||
}
|
||||
return auth, nil
|
||||
}
|
||||
|
||||
@@ -214,14 +214,14 @@ func TestDesktopAuthProvider_OtherRegistriesUseFallback(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDesktopAuthProvider_DHIUsesDockerHubSession(t *testing.T) {
|
||||
for _, host := range []string{DHIRegistryHost, "https://" + DHIRegistryHost, "https://" + DHIRegistryHost + "/"} {
|
||||
for _, host := range []string{DHIRegistryHost, DHIIndexServer, DHIIndexServer + "/"} {
|
||||
t.Run(host, func(t *testing.T) {
|
||||
hub := &fakeHub{session: hubSession("hubuser", testNow.Add(time.Hour))}
|
||||
p := newTestProvider(hub, nil)
|
||||
p.signInToStaging()
|
||||
|
||||
want := desktopCredentials()
|
||||
want.ServerAddress = DHIRegistryHost
|
||||
want.ServerAddress = DHIIndexServer
|
||||
got, err := p.GetAuthConfig(host)
|
||||
assert.NilError(t, err)
|
||||
assert.DeepEqual(t, got, want)
|
||||
|
||||
@@ -45,6 +45,8 @@ const (
|
||||
StagingIndexServer = "https://" + StagingRegistryHost + "/"
|
||||
// DHIRegistryHost is the Docker Hardened Images registry.
|
||||
DHIRegistryHost = "dhi.io"
|
||||
// DHIIndexServer is the credentials key for DHIRegistryHost.
|
||||
DHIIndexServer = "https://" + DHIRegistryHost
|
||||
)
|
||||
|
||||
// GetAuthConfigKey special-cases using the full index address of the official
|
||||
|
||||
Reference in New Issue
Block a user