mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-04 18:48:45 +08:00
remote: fix connhelpers with custom dialer
With the new dial-stdio command the dialer is split from `Client` function in order to access it directly. This breaks the custom connhelpers functionality as support for connhelpers is a feature of the default dialer. If client defines a custom dialer then only it is used without extra modifications. This means that remote driver dialer needs to detect the connhelpers on its own. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> (cherry picked from commit 8f576e579024eae301eef1fc04402352648df1f2)
This commit is contained in:
parent
37b7ad1465
commit
19dbf2f7c4
@ -13,6 +13,7 @@ import (
|
|||||||
util "github.com/docker/buildx/driver/remote/util"
|
util "github.com/docker/buildx/driver/remote/util"
|
||||||
"github.com/docker/buildx/util/progress"
|
"github.com/docker/buildx/util/progress"
|
||||||
"github.com/moby/buildkit/client"
|
"github.com/moby/buildkit/client"
|
||||||
|
"github.com/moby/buildkit/client/connhelper"
|
||||||
"github.com/moby/buildkit/util/tracing/detect"
|
"github.com/moby/buildkit/util/tracing/detect"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
@ -95,7 +96,16 @@ func (d *Driver) Client(ctx context.Context) (*client.Client, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) Dial(ctx context.Context) (net.Conn, error) {
|
func (d *Driver) Dial(ctx context.Context) (net.Conn, error) {
|
||||||
network, addr, ok := strings.Cut(d.InitConfig.EndpointAddr, "://")
|
addr := d.InitConfig.EndpointAddr
|
||||||
|
ch, err := connhelper.GetConnectionHelper(addr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if ch != nil {
|
||||||
|
return ch.ContextDialer(ctx, addr)
|
||||||
|
}
|
||||||
|
|
||||||
|
network, addr, ok := strings.Cut(addr, "://")
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.Errorf("invalid endpoint address: %s", d.InitConfig.EndpointAddr)
|
return nil, errors.Errorf("invalid endpoint address: %s", d.InitConfig.EndpointAddr)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user