Skip to content

Commit 8f576e5

Browse files
committed
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 <[email protected]>
1 parent 4327ee7 commit 8f576e5

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

driver/remote/driver.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
util "github.com/docker/buildx/driver/remote/util"
1414
"github.com/docker/buildx/util/progress"
1515
"github.com/moby/buildkit/client"
16+
"github.com/moby/buildkit/client/connhelper"
1617
"github.com/moby/buildkit/util/tracing/detect"
1718
"github.com/pkg/errors"
1819
)
@@ -95,7 +96,16 @@ func (d *Driver) Client(ctx context.Context) (*client.Client, error) {
9596
}
9697

9798
func (d *Driver) Dial(ctx context.Context) (net.Conn, error) {
98-
network, addr, ok := strings.Cut(d.InitConfig.EndpointAddr, "://")
99+
addr := d.InitConfig.EndpointAddr
100+
ch, err := connhelper.GetConnectionHelper(addr)
101+
if err != nil {
102+
return nil, err
103+
}
104+
if ch != nil {
105+
return ch.ContextDialer(ctx, addr)
106+
}
107+
108+
network, addr, ok := strings.Cut(addr, "://")
99109
if !ok {
100110
return nil, errors.Errorf("invalid endpoint address: %s", d.InitConfig.EndpointAddr)
101111
}

0 commit comments

Comments
 (0)