mirror of
https://github.com/moby/buildkit.git
synced 2026-08-06 07:40:49 +00:00
Rename cgroupNamespaceSupported, add details
This responds to review feedback from https://github.com/moby/buildkit/pull/4308#pullrequestreview-1658246195 Signed-off-by: Mark Yen <mark.yen@suse.com>
This commit is contained in:
@@ -138,7 +138,7 @@ func GenerateSpec(ctx context.Context, meta executor.Meta, mounts []executor.Mou
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if cgroupNamespaceSupported() {
|
||||
if cgroupV2NamespaceSupported() {
|
||||
s.Linux.Namespaces = append(s.Linux.Namespaces, specs.LinuxNamespace{
|
||||
Type: specs.CgroupNamespace,
|
||||
})
|
||||
|
||||
@@ -56,6 +56,6 @@ func getTracingSocket() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func cgroupNamespaceSupported() bool {
|
||||
func cgroupV2NamespaceSupported() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -148,7 +148,11 @@ func getTracingSocket() string {
|
||||
return fmt.Sprintf("unix://%s", tracingSocketPath)
|
||||
}
|
||||
|
||||
func cgroupNamespaceSupported() bool {
|
||||
func cgroupV2NamespaceSupported() bool {
|
||||
// Check if cgroups v2 namespaces are supported. Trying to do cgroup
|
||||
// namespaces with cgroups v1 results in EINVAL when we encounter a
|
||||
// non-standard hierarchy.
|
||||
// See https://github.com/moby/buildkit/issues/4108
|
||||
cgroupNSOnce.Do(func() {
|
||||
if _, err := os.Stat("/proc/self/ns/cgroup"); os.IsNotExist(err) {
|
||||
return
|
||||
|
||||
@@ -97,6 +97,6 @@ func getTracingSocket() string {
|
||||
return fmt.Sprintf("npipe://%s", filepath.ToSlash(tracingSocketPath))
|
||||
}
|
||||
|
||||
func cgroupNamespaceSupported() bool {
|
||||
func cgroupV2NamespaceSupported() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user