From 46f5833afce00109c6fa99858d0718cd8aeb4d6e Mon Sep 17 00:00:00 2001 From: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> Date: Mon, 12 Oct 2026 13:27:01 +0200 Subject: [PATCH] build(deps): bump secrets-engine client to v0.2.0 The client replaced ErrSecretsEngineNotAvailable with a typed ConnectError. Any failure to reach the secrets engine now falls back to the Docker CLI credentials and is logged at debug level. Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- internal/registry/desktop.go | 7 ++++++- internal/registry/desktop_test.go | 20 ++++++++++++++++++-- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 48938d03c..dd1b1ec13 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/docker/cli v29.9.0+incompatible github.com/docker/cli-docs-tool v0.11.0 github.com/docker/go-units v0.5.0 - github.com/docker/secrets-engine/client v0.1.2 + github.com/docker/secrets-engine/client v0.2.0 github.com/docker/secrets-engine/x v0.8.3 github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203 github.com/fsnotify/fsevents v0.2.0 diff --git a/go.sum b/go.sum index 241cfe3e8..ead67fb9e 100644 --- a/go.sum +++ b/go.sum @@ -90,8 +90,8 @@ github.com/docker/go-metrics v0.1.0 h1:r76KPNpstz+IvQKSWpYegSkkyzex0V3A1ZGVx6bhG github.com/docker/go-metrics v0.1.0/go.mod h1:PciI3sONtB051kXALN1JoIlpcu54E1FuPh+4DuqEzyw= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/secrets-engine/client v0.1.2 h1:MFfk2TTo6h25DczTQ2ByQwgg2aVrVnSEis979Xle7KM= -github.com/docker/secrets-engine/client v0.1.2/go.mod h1:5Ocu33awF0dvSOCd9Z21qP0eFEgFn47gJROzas0pghc= +github.com/docker/secrets-engine/client v0.2.0 h1:69Q63N5VDbXbxPPgm0LjUtRJ4O41q4cQeFpUxsHZUJo= +github.com/docker/secrets-engine/client v0.2.0/go.mod h1:dL3y9wh+HVHMTInwOOmAmjai6oARC8T+se30RnWgrLs= github.com/docker/secrets-engine/x v0.8.3 h1:0rt91D54Ah6vI96qbc0Qcaxbkd0n36QAkQm+2614FzA= github.com/docker/secrets-engine/x v0.8.3/go.mod h1:+s6rb56pq1B376jzzkGqZreFJ3mUtkz+kaYlMuj7/Qs= github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203 h1:XBBHcIb256gUJtLmY22n99HaZTz+r2Z51xUPi01m3wg= diff --git a/internal/registry/desktop.go b/internal/registry/desktop.go index 043e67528..7dadc720c 100644 --- a/internal/registry/desktop.go +++ b/internal/registry/desktop.go @@ -247,6 +247,11 @@ func logDesktopFallback(name string, err error) { logrus.Warnf("could not use the %s session from Docker Desktop, using Docker CLI credentials instead: %v", name, err) } +// isSessionUnavailable reports whether err means there is no Desktop session +// to use, including any failure to reach the secrets engine. func isSessionUnavailable(err error) bool { - return errors.Is(err, seclient.ErrSecretsEngineNotAvailable) || errors.Is(err, dockerhub.ErrNoSession) || errors.Is(err, errSessionExpired) + if _, ok := errors.AsType[*seclient.ConnectError](err); ok { + return true + } + return errors.Is(err, dockerhub.ErrNoSession) || errors.Is(err, errSessionExpired) } diff --git a/internal/registry/desktop_test.go b/internal/registry/desktop_test.go index 40c0c083f..bae0e296a 100644 --- a/internal/registry/desktop_test.go +++ b/internal/registry/desktop_test.go @@ -301,7 +301,11 @@ func TestDesktopAuthProvider_FallsBackWithoutUsableSession(t *testing.T) { }{ { name: "secrets engine not running", - hub: &fakeHub{sessionErr: fmt.Errorf("%w: dial unix engine.sock: connect: no such file or directory", seclient.ErrSecretsEngineNotAvailable)}, + hub: &fakeHub{sessionErr: connectError(seclient.ReasonNotRunning)}, + }, + { + name: "secrets engine socket not accessible", + hub: &fakeHub{sessionErr: connectError(seclient.ReasonPermissionDenied)}, }, { name: "nobody signed in", @@ -379,7 +383,11 @@ func TestDesktopAuthProvider_RetriesAfterInterval(t *testing.T) { func TestIsSessionUnavailable(t *testing.T) { for _, err := range []error{ - fmt.Errorf("%w: dial unix engine.sock", seclient.ErrSecretsEngineNotAvailable), + connectError(seclient.ReasonNotRunning), + fmt.Errorf("get session: %w", connectError(seclient.ReasonNotRunning)), + connectError(seclient.ReasonPermissionDenied), + connectError(seclient.ReasonTimeout), + connectError(seclient.ReasonUnknown), dockerhub.ErrNoSession, dockerhub.ErrNoDefaultProfile, errSessionExpired, @@ -395,6 +403,14 @@ func TestIsSessionUnavailable(t *testing.T) { } } +func connectError(reason seclient.ConnectReason) error { + return &seclient.ConnectError{ + Reason: reason, + SocketPath: "/run/engine.sock", + Err: errors.New("dial unix /run/engine.sock"), + } +} + func TestDesktopAuthProvider_ReusesSessionUntilExpiry(t *testing.T) { expiresAt := testNow.Add(10 * time.Minute) hub := &fakeHub{session: hubSession("hubuser", expiresAt)}