mirror of
https://github.com/docker/compose.git
synced 2026-11-18 22:27:03 +00:00
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>
This commit is contained in:
parent
175cc8349f
commit
46f5833afc
4 changed files with 27 additions and 6 deletions
2
go.mod
2
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
|
||||
|
|
|
|||
4
go.sum
4
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=
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue