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:
Alano Terblanche
2026-10-07 14:24:28 +02:00
committed by Nicolas De loof
parent 81b6b59e79
commit e22de3b574
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -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
}
+2 -2
View File
@@ -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)
+2
View File
@@ -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