-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Marat Radchenko <[email protected]>
- Loading branch information
1 parent
4c89091
commit 2739a7f
Showing
15 changed files
with
164 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
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 withProcessArgs(args ...string) oci.SpecOpts { | ||
return oci.WithProcessArgs(args...) | ||
} | ||
|
||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
//go:build !windows && !freebsd | ||
// +build !windows,!freebsd | ||
|
||
package snapshot | ||
|
||
import ( | ||
|
8 changes: 4 additions & 4 deletions
8
snapshot/diffapply_windows.go → snapshot/diffapply_unsupported.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
//go:build windows | ||
// +build windows | ||
//go:build !linux | ||
|
||
package snapshot | ||
|
||
import ( | ||
"context" | ||
"runtime" | ||
|
||
"github.com/containerd/containerd/leases" | ||
"github.com/containerd/containerd/snapshots" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func (sn *mergeSnapshotter) diffApply(ctx context.Context, dest Mountable, diffs ...Diff) (_ snapshots.Usage, rerr error) { | ||
return snapshots.Usage{}, errors.New("diffApply not yet supported on windows") | ||
return snapshots.Usage{}, errors.New("diffApply not yet supported on " + runtime.GOOS) | ||
} | ||
|
||
func needsUserXAttr(ctx context.Context, sn Snapshotter, lm leases.Manager) (bool, error) { | ||
return false, errors.New("needs userxattr not supported on windows") | ||
return false, errors.New("needs userxattr not supported on " + runtime.GOOS) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package snapshot | ||
|
||
import ( | ||
"golang.org/x/sys/unix" | ||
"os" | ||
|
||
"github.com/containerd/containerd/mount" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func (lm *localMounter) Mount() (string, error) { | ||
lm.mu.Lock() | ||
defer lm.mu.Unlock() | ||
|
||
if lm.mounts == nil && lm.mountable != nil { | ||
mounts, release, err := lm.mountable.Mount() | ||
if err != nil { | ||
return "", err | ||
} | ||
lm.mounts = mounts | ||
lm.release = release | ||
} | ||
|
||
if len(lm.mounts) == 1 && lm.mounts[0].Type == "bind" { | ||
ro := false | ||
for _, opt := range lm.mounts[0].Options { | ||
if opt == "ro" { | ||
ro = true | ||
break | ||
} | ||
} | ||
if !ro { | ||
return lm.mounts[0].Source, nil | ||
} | ||
} | ||
|
||
dir, err := os.MkdirTemp("", "buildkit-mount") | ||
if err != nil { | ||
return "", errors.Wrap(err, "failed to create temp dir") | ||
} | ||
|
||
if err := mount.All(lm.mounts, dir); err != nil { | ||
os.RemoveAll(dir) | ||
return "", errors.Wrapf(err, "failed to mount %s: %+v", dir, lm.mounts) | ||
} | ||
lm.target = dir | ||
return dir, nil | ||
} | ||
|
||
func (lm *localMounter) Unmount() error { | ||
lm.mu.Lock() | ||
defer lm.mu.Unlock() | ||
|
||
if lm.target != "" { | ||
if err := mount.UnmountRecursive(lm.target, unix.MNT_FORCE); err != nil { | ||
return err | ||
} | ||
os.RemoveAll(lm.target) | ||
lm.target = "" | ||
} | ||
|
||
if lm.release != nil { | ||
return lm.release() | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package git | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"os/exec" | ||
"runtime" | ||
) | ||
|
||
func runWithStandardUmask(ctx context.Context, cmd *exec.Cmd) error { | ||
return errors.New("runWithStandardUmask not supported on " + runtime.GOOS) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
//go:build !windows && !freebsd | ||
// +build !windows,!freebsd | ||
|
||
package git | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package appdefaults | ||
|
||
const ( | ||
Address = "unix:///run/buildkit/buildkitd.sock" | ||
traceSocketPath = "/run/buildkit/otel-grpc.sock" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//go:build !linux && !windows | ||
|
||
package appdefaults | ||
|
||
const ( | ||
Address = "unix:///var/run/buildkit/buildkitd.sock" | ||
traceSocketPath = "/var/run/buildkit/otel-grpc.sock" | ||
) |