|
4 | 4 | "context"
|
5 | 5 | "os"
|
6 | 6 | "path/filepath"
|
7 |
| - goRuntime "runtime" |
8 | 7 | "strconv"
|
9 | 8 | "strings"
|
10 | 9 |
|
@@ -48,28 +47,13 @@ type WorkerOptions struct {
|
48 | 47 | }
|
49 | 48 |
|
50 | 49 | // 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) { |
55 | 51 | 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...) |
66 | 53 | 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) |
68 | 55 | }
|
69 |
| - return newContainerd( |
70 |
| - client, |
71 |
| - workerOpts, |
72 |
| - ) |
| 56 | + return newContainerd(client, workerOpts) |
73 | 57 | }
|
74 | 58 |
|
75 | 59 | func newContainerd(client *containerd.Client, workerOpts WorkerOptions) (base.WorkerOpt, error) {
|
|
0 commit comments