Choose the best DIND storage strategy for the current platform.
(task_id: &str)
| 54 | |
| 55 | /// Choose the best DIND storage strategy for the current platform. |
| 56 | fn dind_storage_strategy(task_id: &str) -> DindStorage { |
| 57 | if cfg!(target_os = "macos") { |
| 58 | // Docker Desktop / LinuxKit: tmpfs supports user.* xattrs and avoids |
| 59 | // the execve() bug on FUSE mounts (docker/for-mac#7413). |
| 60 | DindStorage::Tmpfs |
| 61 | } else { |
| 62 | // Linux: tmpfs lacks user.* xattrs on kernels < 6.6, and the |
| 63 | // container's overlayfs doesn't support nested overlay in userns. |
| 64 | // Named volume (backed by host ext4/xfs) works on all kernels. |
| 65 | let kernel_ok = std::fs::read_to_string("/proc/sys/kernel/osrelease") |
| 66 | .ok() |
| 67 | .and_then(|r| { |
| 68 | let mut parts = r.trim().splitn(3, '.'); |
| 69 | let major: u32 = parts.next()?.parse().ok()?; |
| 70 | let minor: u32 = parts.next()?.parse().ok()?; |
| 71 | Some(major > 6 || (major == 6 && minor >= 6)) |
| 72 | }) |
| 73 | .unwrap_or(false); |
| 74 | if kernel_ok { |
| 75 | DindStorage::Tmpfs |
| 76 | } else { |
| 77 | DindStorage::NamedVolume(format!("tsk-dind-{task_id}")) |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | /// Checks whether a cgroup v2 controller (e.g. "cpu", "memory") is delegated |
| 83 | /// to the current user session. Rootless Podman requires controllers to be |
no test coverage detected