(docker: &Docker)
| 29 | const DEFAULT_BUILD_NO_PROGRESS_TIMEOUT_SECS: u64 = 1800; |
| 30 | |
| 31 | async fn docker_daemon_platform(docker: &Docker) -> Result<String> { |
| 32 | let info = docker |
| 33 | .info() |
| 34 | .await |
| 35 | .into_diagnostic() |
| 36 | .wrap_err("failed to query local Docker daemon info")?; |
| 37 | let os = info |
| 38 | .os_type |
| 39 | .as_deref() |
| 40 | .filter(|value| !value.is_empty()) |
| 41 | .ok_or_else(|| miette::miette!("Docker daemon did not report an operating system"))?; |
| 42 | let arch = info |
| 43 | .architecture |
| 44 | .as_deref() |
| 45 | .filter(|value| !value.is_empty()) |
| 46 | .ok_or_else(|| miette::miette!("Docker daemon did not report an architecture"))?; |
| 47 | |
| 48 | normalize_docker_platform(os, arch) |
| 49 | } |
| 50 | |
| 51 | fn normalize_docker_platform(os: &str, arch: &str) -> Result<String> { |
| 52 | // Remote or non-standard daemons may return mixed-case arch strings. |
no test coverage detected