Skip to content

Commit 84f458e

Browse files
committed
worker/containerd: NewWorkerOpt: remove workaround for named pipes
This workaround was added in 414edfa, pending changes in containerd. Those changes were included in containerd 1.7.12, which was vendored in bce2f79, so the workaround should no longer be needed. I also reformatted the code, as there's no longer a need to wrap this function since the list of arguments has been reduced. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent d7978d1 commit 84f458e

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

worker/containerd/containerd.go

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"os"
66
"path/filepath"
7-
goRuntime "runtime"
87
"strconv"
98
"strings"
109

@@ -48,28 +47,13 @@ type WorkerOptions struct {
4847
}
4948

5049
// NewWorkerOpt creates a WorkerOpt.
51-
func NewWorkerOpt(
52-
workerOpts WorkerOptions,
53-
opts ...containerd.ClientOpt,
54-
) (base.WorkerOpt, error) {
50+
func NewWorkerOpt(workerOpts WorkerOptions, opts ...containerd.ClientOpt) (base.WorkerOpt, error) {
5551
opts = append(opts, containerd.WithDefaultNamespace(workerOpts.Namespace))
56-
57-
address := workerOpts.Address
58-
59-
if goRuntime.GOOS == "windows" {
60-
// TODO(profnandaa): once the upstream PR[1] is merged and
61-
// vendored in buildkit, we will remove this block.
62-
// [1] https://github.com/containerd/containerd/pull/9412
63-
address = strings.TrimPrefix(address, "npipe://")
64-
}
65-
client, err := containerd.New(address, opts...)
52+
client, err := containerd.New(workerOpts.Address, opts...)
6653
if err != nil {
67-
return base.WorkerOpt{}, errors.Wrapf(err, "failed to connect client to %q . make sure containerd is running", address)
54+
return base.WorkerOpt{}, errors.Wrapf(err, "failed to connect client to %q . make sure containerd is running", workerOpts.Address)
6855
}
69-
return newContainerd(
70-
client,
71-
workerOpts,
72-
)
56+
return newContainerd(client, workerOpts)
7357
}
7458

7559
func newContainerd(client *containerd.Client, workerOpts WorkerOptions) (base.WorkerOpt, error) {

0 commit comments

Comments
 (0)