Skip to content

Commit

Permalink
Build fixes for macOS
Browse files Browse the repository at this point in the history
Signed-off-by: Marat Radchenko <[email protected]>
  • Loading branch information
slonopotamus committed Aug 3, 2023
1 parent 3197395 commit c8f4dfa
Show file tree
Hide file tree
Showing 355 changed files with 51,333 additions and 4,776 deletions.
4 changes: 2 additions & 2 deletions cache/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ func checkDescriptor(ctx context.Context, t *testing.T, cs content.Store, desc o
}

func TestMergeOp(t *testing.T) {
if runtime.GOOS == "windows" || runtime.GOOS == "freebsd" {
if runtime.GOOS != "linux" {
t.Skipf("Depends on unimplemented merge-op support on %s", runtime.GOOS)
}

Expand Down Expand Up @@ -2140,7 +2140,7 @@ func TestMergeOp(t *testing.T) {
}

func TestDiffOp(t *testing.T) {
if runtime.GOOS == "windows" || runtime.GOOS == "freebsd" {
if runtime.GOOS != "linux" {
t.Skipf("Depends on unimplemented diff-op support on %s", runtime.GOOS)
}

Expand Down
8 changes: 0 additions & 8 deletions cmd/buildkitd/constants_unix.go

This file was deleted.

5 changes: 0 additions & 5 deletions cmd/buildkitd/constants_windows.go

This file was deleted.

9 changes: 5 additions & 4 deletions cmd/buildkitd/main_containerd_worker.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//go:build linux || windows || freebsd
// +build linux windows freebsd
//go:build linux || windows || freebsd || darwin
// +build linux windows freebsd darwin

package main

import (
"context"
"github.com/containerd/containerd/defaults"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -39,7 +40,7 @@ func init() {
}

if defaultConf.Workers.Containerd.Address == "" {
defaultConf.Workers.Containerd.Address = defaultContainerdAddress
defaultConf.Workers.Containerd.Address = defaults.DefaultAddress
}

if defaultConf.Workers.Containerd.Namespace == "" {
Expand Down Expand Up @@ -159,7 +160,7 @@ func init() {

func applyContainerdFlags(c *cli.Context, cfg *config.Config) error {
if cfg.Workers.Containerd.Address == "" {
cfg.Workers.Containerd.Address = defaultContainerdAddress
cfg.Workers.Containerd.Address = defaults.DefaultAddress
}

if c.GlobalIsSet("containerd-worker") {
Expand Down
57 changes: 57 additions & 0 deletions executor/oci/spec_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package oci

import (
"github.com/containerd/containerd/oci"
"github.com/docker/docker/pkg/idtools"
"github.com/moby/buildkit/solver/pb"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
)

func generateMountOpts(resolvConf, hostsFile string) ([]oci.SpecOpts, error) {
return nil, nil
}

// generateSecurityOpts may affect mounts, so must be called after generateMountOpts
func generateSecurityOpts(mode pb.SecurityMode, apparmorProfile string, selinuxB bool) ([]oci.SpecOpts, error) {
if mode == pb.SecurityMode_INSECURE {
return nil, errors.New("no support for running in insecure mode on Darwin")
}
return nil, nil
}

// generateProcessModeOpts may affect mounts, so must be called after generateMountOpts
func generateProcessModeOpts(mode ProcessMode) ([]oci.SpecOpts, error) {
if mode == NoProcessSandbox {
return nil, errors.New("no support for NoProcessSandbox on Darwin")
}
return nil, nil
}

func generateIDmapOpts(idmap *idtools.IdentityMapping) ([]oci.SpecOpts, error) {
if idmap == nil {
return nil, nil
}
return nil, errors.New("no support for IdentityMapping on Darwin")
}

func generateRlimitOpts(ulimits []*pb.Ulimit) ([]oci.SpecOpts, error) {
if len(ulimits) == 0 {
return nil, nil
}
return nil, errors.New("no support for POSIXRlimit on Darwin")
}

// tracing is not implemented on Darwin
func getTracingSocketMount(socket string) *specs.Mount {
return nil
}

// tracing is not implemented on Darwin
func getTracingSocket() string {
return ""
}

func cgroupNamespaceSupported() bool {
return false
}
40 changes: 25 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.4.1
github.com/Masterminds/semver/v3 v3.1.0
github.com/Microsoft/go-winio v0.6.1
github.com/Microsoft/hcsshim v0.10.0-rc.8
github.com/Microsoft/hcsshim v0.10.0-rc.9
github.com/agext/levenshtein v1.2.3
github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2
github.com/aws/aws-sdk-go-v2/config v1.18.16
Expand All @@ -17,7 +17,7 @@ require (
github.com/aws/smithy-go v1.13.5
github.com/containerd/console v1.0.3
github.com/containerd/containerd v1.7.2
github.com/containerd/continuity v0.4.1
github.com/containerd/continuity v0.4.2-0.20230616210509-1e0d26eb2381
github.com/containerd/fuse-overlayfs-snapshotter v1.0.2
github.com/containerd/go-cni v1.1.9
github.com/containerd/go-runc v1.1.0
Expand All @@ -42,7 +42,7 @@ require (
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/golang-lru v0.5.4
github.com/in-toto/in-toto-golang v0.5.0
github.com/klauspost/compress v1.16.3
github.com/klauspost/compress v1.16.5
github.com/mitchellh/hashstructure/v2 v2.0.2
github.com/moby/locker v1.0.1
github.com/moby/patternmatcher v0.5.0
Expand All @@ -62,13 +62,13 @@ require (
github.com/serialx/hashring v0.0.0-20190422032157-8b2912629002
github.com/sirupsen/logrus v1.9.3
github.com/spdx/tools-golang v0.5.1
github.com/stretchr/testify v1.8.3
github.com/stretchr/testify v1.8.4
github.com/tonistiigi/fsutil v0.0.0-20230629203738-36ef4d8c0dbb
github.com/tonistiigi/go-actions-cache v0.0.0-20220404170428-0bdeb6e1eac7
github.com/tonistiigi/go-archvariant v1.0.0
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea
github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531
github.com/urfave/cli v1.22.12
github.com/urfave/cli v1.22.13
go.etcd.io/bbolt v1.3.7
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.40.0
Expand All @@ -81,13 +81,13 @@ require (
go.opentelemetry.io/otel/sdk v1.14.0
go.opentelemetry.io/otel/trace v1.14.0
go.opentelemetry.io/proto/otlp v0.19.0
golang.org/x/crypto v0.2.0
golang.org/x/crypto v0.9.0
golang.org/x/net v0.10.0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.8.0
golang.org/x/sync v0.3.0
golang.org/x/sys v0.9.0
golang.org/x/time v0.3.0
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4
google.golang.org/grpc v1.53.0
google.golang.org/genproto v0.0.0-20230323212658-478b75c54725
google.golang.org/grpc v1.54.0
google.golang.org/protobuf v1.30.0
kernel.org/pub/linux/libs/security/libcap/cap v1.2.67
)
Expand All @@ -114,8 +114,9 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.18.6 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/container-orchestrated-devices/container-device-interface v0.5.4 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/containerd/fifo v1.1.0 // indirect
github.com/containerd/ttrpc v1.2.2 // indirect
Expand All @@ -125,13 +126,14 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/hanwen/go-fuse/v2 v2.2.0 // indirect
Expand All @@ -143,6 +145,7 @@ require (
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/moby/sys/mount v0.3.3 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/opencontainers/runtime-tools v0.9.1-0.20221107090550-2e043c6bd626 // indirect
github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
Expand All @@ -151,13 +154,20 @@ require (
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.4.0 // indirect
github.com/shibumi/go-pathspec v1.3.0 // indirect
github.com/vbatts/tar-split v0.11.2 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect
go.opentelemetry.io/otel/metric v0.37.0 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.7.0 // indirect
golang.org/x/tools v0.8.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
kernel.org/pub/linux/libs/security/libcap/psx v1.2.67 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/containerd/containerd => github.com/macOScontainers/containerd v1.5.1-0.20230718204310-f71d3e86cacd

replace github.com/docker/docker => github.com/macOScontainers/moby v0.0.0-20230727202221-34623d0a265e
Loading

0 comments on commit c8f4dfa

Please sign in to comment.