Windows runner: free disk in claims; dist builds flow-windows-x86_64.exe 6f66e397539c
GetDiskFreeSpaceExW through windows-sys (already in the tree through wasmtime). dist builds the release flow.exe with MinGW-w64. refs #83
- Author
- Andy McCall @andymccall <[email protected]>
- When
- · 2026-10-26 02:26 UTC
- Signature
- ◈ sealed by Andy McCall
- Hash
6f66e397539c2eb66fbb3522121b0add52221a43219e9834a4f1773d584ccb45- Depends on
- 28cc603f737d 3554afefb6aa 62829d15ef09 72772aa01d6b c3db750ed96e e0918b887850 e6949d87205b f29b88af0d9b f849c7889471
- Depended on by
- 21a3ea4aab88 f4dfd742b30d 494a1b9a8ac2
- In bookmarks
- main
- In tags
- v0.4.0 v0.5.0 v0.5.1 v0.5.2 v0.5.3
- Edits
- 12 atoms, 0 tree operations, 6 files
Browse the tree at this change
modified .flow/pipeline.kdl +3 −0
| … | 124 unchanged lines |
||
| 125 | 125 | artifact "flow-linux-riscv64" { |
|
| 126 | 126 | path "/src/target/dist-flat/flow-linux-riscv64" |
|
| 127 | 127 | } |
|
| 128 | + | artifact "flow-windows-x86_64.exe" { |
|
| 129 | + | path "/src/target/dist-flat/flow-windows-x86_64.exe" |
|
| 130 | + | } |
|
| 128 | 131 | artifact "SHA256SUMS" { |
|
| 129 | 132 | path "/src/target/dist-flat/SHA256SUMS" |
|
| 130 | 133 | } |
|
| … | 11 unchanged lines |
modified CHANGELOG.md +1 −1
| … | 3 unchanged lines |
||
| 4 | 4 | ||
| 5 | 5 | ## Unreleased |
|
| 6 | 6 | ||
| 7 | - | - **`flow` builds for Windows (#83, step 2 begun):** `cargo build --target x86_64-pc-windows-gnu` gives a `flow.exe` that offers the WASM tier: the syscall tier, the guest helpers and the egress proxy are Linux's only (a Windows build says the syscall tier "runs only on Linux"), cache pruning by reads stays on Linux, and file modes, links and sizes go through a small `portable` module (modes are not kept on Windows). Free disk, load and kernel are not measured there yet, and a Windows runner does not update itself. Nothing changes on Linux or Android. Tried in the Windows VM on Earth: `flow.exe tiers` offers wasm, a local `flow run` of a 120-step WASM job passes, and registered as runner `windows-1` (label `windows`) it ran andymccall/windows-runner-demo's job from the hub (run #1). Helpers start from the running binary's path on Windows (`/proc/self/exe` on Linux and Android). |
|
| 7 | + | - **`flow` builds for Windows (#83, step 2 begun):** `cargo build --target x86_64-pc-windows-gnu` gives a `flow.exe` that offers the WASM tier: the syscall tier, the guest helpers and the egress proxy are Linux's only (a Windows build says the syscall tier "runs only on Linux"), cache pruning by reads stays on Linux, and file modes, links and sizes go through a small `portable` module (modes are not kept on Windows). Its claims report free disk (`GetDiskFreeSpaceExW`); load and kernel are not measured there yet, and a Windows runner does not update itself. `dist` builds `flow-windows-x86_64.exe` too. Nothing changes on Linux or Android. Tried in the Windows VM on Earth: `flow.exe tiers` offers wasm, a local `flow run` of a 120-step WASM job passes, and registered as runner `windows-1` (label `windows`) it ran andymccall/windows-runner-demo's job from the hub (run #1). Helpers start from the running binary's path on Windows (`/proc/self/exe` on Linux and Android). |
|
| 8 | 8 | - **The syscall tier's loopback reaches TCP (#73):** with `network "loopback"`, a job may open IPv4 and IPv6 sockets, which in its own network namespace reach only its `lo`, so a server it starts on 127.0.0.1 answers it (a conformance suite over an emulator's HTTP control port, which skipped every test on narvi-1). With `network "isolated"` sockets other than `AF_UNIX` are still refused. |
|
| 9 | 9 | - **Runner builds in releases (oxygenhub#322):** a `dist` job (`scripts/dist.sh`, on a change to `Cargo.toml` or the script) builds `flow` stripped for Linux x86_64, aarch64 and riscv64 (glibc 2.28 and later) as `flow-linux-ARCH`, named by the architecture a runner reports, with `SHA256SUMS`: the files a release carries for runners that update themselves. |
|
| 10 | 10 | - **Runners ask the hub for their update (oxygenhub#322):** once the hub has answered a claim, and every 15 minutes, a runner asks `GET /api/v1/flow/runner/update`; when the hub offers a build, it downloads it (kept in the home's `updates/`), refuses it unless its size and BLAKE3 are those the hub attests, and installs it as `flow runner update` does, leaving within 600 s, or for a dry run checks it and says what would happen. What it did goes back to the hub once per outcome, and a proof or a rollback is told at the next start. `[runner.update] allow = false` refuses and says so; a hub without runner updates (404) is simply asked again later. |
|
| … | 99 unchanged lines |
modified Cargo.lock +1 −0
| … | 838 unchanged lines |
||
| 839 | 839 | "wasmtime", |
|
| 840 | 840 | "wasmtime-wasi", |
|
| 841 | 841 | "wat", |
|
| 842 | + | "windows-sys 0.61.2", |
|
| 842 | 843 | ] |
|
| 843 | 844 | ||
| 844 | 845 | [[package]] |
|
| … | 2403 unchanged lines |
modified crates/flow/Cargo.toml +4 −0
| … | 33 unchanged lines |
||
| 34 | 34 | wasmtime = { version = "=49.0.4", default-features = false, features = ["cranelift", "runtime", "std", "parallel-compilation"] } |
|
| 35 | 35 | wasmtime-wasi = { version = "=49.0.4", default-features = false, features = ["p1"] } |
|
| 36 | 36 | ||
| 37 | + | # A Windows runner's free disk (oxygenflow#83); already in the tree through wasmtime. |
|
| 38 | + | [target.'cfg(windows)'.dependencies] |
|
| 39 | + | windows-sys = { version = "0.61", features = ["Win32_Storage_FileSystem"] } |
|
| 40 | + | ||
| 37 | 41 | [dev-dependencies] |
|
| 38 | 42 | tempfile.workspace = true |
|
| 39 | 43 | # Test modules written as text. |
|
| … | 1 unchanged lines |
modified crates/flow/src/facts.rs +12 −4
| … | 41 unchanged lines |
||
| 42 | 42 | } |
|
| 43 | 43 | ||
| 44 | 44 | /// Free space for an unprivileged writer on the file system holding `path`, |
|
| 45 | - | /// in MiB; not measured on Windows. |
|
| 45 | + | /// in MiB. |
|
| 46 | 46 | #[cfg(unix)] |
|
| 47 | 47 | pub fn free_disk_mib(path: &std::path::Path) -> Option<u64> { |
|
| 48 | 48 | use std::os::unix::ffi::OsStrExt; |
|
| … | 6 unchanged lines |
||
| 55 | 55 | Some((s.f_bavail as u64).saturating_mul(s.f_frsize as u64) >> 20) |
|
| 56 | 56 | } |
|
| 57 | 57 | ||
| 58 | - | #[cfg(not(unix))] |
|
| 59 | - | pub fn free_disk_mib(_path: &std::path::Path) -> Option<u64> { |
|
| 60 | - | None |
|
| 58 | + | #[cfg(windows)] |
|
| 59 | + | pub fn free_disk_mib(path: &std::path::Path) -> Option<u64> { |
|
| 60 | + | use std::os::windows::ffi::OsStrExt; |
|
| 61 | + | let wide: Vec<u16> = path.as_os_str().encode_wide().chain(Some(0)).collect(); |
|
| 62 | + | let mut free: u64 = 0; |
|
| 63 | + | // SAFETY: `wide` is a NUL-terminated path and `free` a writable u64; |
|
| 64 | + | // the totals it may also fill are not asked for. |
|
| 65 | + | let ok = unsafe { |
|
| 66 | + | windows_sys::Win32::Storage::FileSystem::GetDiskFreeSpaceExW(wide.as_ptr(), &mut free, std::ptr::null_mut(), std::ptr::null_mut()) |
|
| 67 | + | }; |
|
| 68 | + | (ok != 0).then_some(free >> 20) |
|
| 61 | 69 | } |
|
| 62 | 70 | ||
| 63 | 71 | /// The disk the files under `dir` take (their blocks, not their sizes: a |
|
| … | 93 unchanged lines |
modified scripts/dist.sh +11 −3
| … | 2 unchanged lines |
||
| 3 | 3 | # (glibc 2.28 and later), as release assets runners update themselves from |
|
| 4 | 4 | # (docs/jetstream.md §8.2, oxygenhub#322): target/dist-flat/flow-linux-ARCH, |
|
| 5 | 5 | # named by the architecture a runner reports (x86_64, aarch64, riscv64), |
|
| 6 | - | # plain stripped binaries, and SHA256SUMS of them. |
|
| 6 | + | # plain stripped binaries; flow-windows-x86_64.exe (the WASM tier only); |
|
| 7 | + | # and SHA256SUMS of them. |
|
| 7 | 8 | # |
|
| 8 | 9 | # scripts/dist.sh [VERSION] (default: the package version) |
|
| 9 | 10 | # ONLY=x86_64 scripts/dist.sh builds one architecture (a glob) |
|
| 10 | 11 | # |
|
| 11 | 12 | # Needs: rustup targets aarch64-unknown-linux-gnu and |
|
| 12 | - | # riscv64gc-unknown-linux-gnu; cargo-zigbuild and zig on PATH. |
|
| 13 | + | # riscv64gc-unknown-linux-gnu and x86_64-pc-windows-gnu; cargo-zigbuild |
|
| 14 | + | # and zig on PATH; the MinGW-w64 gcc. |
|
| 13 | 15 | set -euo pipefail |
|
| 14 | 16 | ||
| 15 | 17 | cd "$(dirname "$0")/.." |
|
| … | 14 unchanged lines |
||
| 30 | 32 | cargo zigbuild -q --release --locked --target "$triple.2.28" -p flow --bin flow |
|
| 31 | 33 | install -m 0755 "target/$triple/release/flow" "$OUT/flow-linux-$arch" |
|
| 32 | 34 | done |
|
| 33 | - | (cd "$OUT" && sha256sum flow-linux-* > SHA256SUMS && cat SHA256SUMS) |
|
| 35 | + | # Windows (oxygenflow#83): the WASM tier only, with the MinGW-w64 toolchain. |
|
| 36 | + | if [ -z "${ONLY:-}" ] || [[ windows-x86_64 == $ONLY ]]; then |
|
| 37 | + | echo "== windows-x86_64 (x86_64-pc-windows-gnu)" |
|
| 38 | + | cargo build -q --release --locked --target x86_64-pc-windows-gnu -p flow --bin flow |
|
| 39 | + | install -m 0755 target/x86_64-pc-windows-gnu/release/flow.exe "$OUT/flow-windows-x86_64.exe" |
|
| 40 | + | fi |
|
| 41 | + | (cd "$OUT" && sha256sum flow-* > SHA256SUMS && cat SHA256SUMS) |