Skip to content

Commit

Permalink
Merge pull request #5399 from thaJeztah/remove_npipe_hack
Browse files Browse the repository at this point in the history
worker/containerd: NewWorkerOpt: remove workaround for named pipes
  • Loading branch information
crazy-max authored Oct 8, 2024
2 parents 0cb9ad6 + 84f458e commit f3f34fb
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions worker/containerd/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"os"
"path/filepath"
goRuntime "runtime"
"strconv"
"strings"

Expand Down Expand Up @@ -48,28 +47,13 @@ type WorkerOptions struct {
}

// NewWorkerOpt creates a WorkerOpt.
func NewWorkerOpt(
workerOpts WorkerOptions,
opts ...containerd.ClientOpt,
) (base.WorkerOpt, error) {
func NewWorkerOpt(workerOpts WorkerOptions, opts ...containerd.ClientOpt) (base.WorkerOpt, error) {
opts = append(opts, containerd.WithDefaultNamespace(workerOpts.Namespace))

address := workerOpts.Address

if goRuntime.GOOS == "windows" {
// TODO(profnandaa): once the upstream PR[1] is merged and
// vendored in buildkit, we will remove this block.
// [1] https://github.com/containerd/containerd/pull/9412
address = strings.TrimPrefix(address, "npipe://")
}
client, err := containerd.New(address, opts...)
client, err := containerd.New(workerOpts.Address, opts...)
if err != nil {
return base.WorkerOpt{}, errors.Wrapf(err, "failed to connect client to %q . make sure containerd is running", address)
return base.WorkerOpt{}, errors.Wrapf(err, "failed to connect client to %q . make sure containerd is running", workerOpts.Address)
}
return newContainerd(
client,
workerOpts,
)
return newContainerd(client, workerOpts)
}

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

0 comments on commit f3f34fb

Please sign in to comment.