Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

#356

Run CI on a Mac: the runner in a container VM, and native macOS jobs

open · opened by keenan 12d ago

keenan opened this 12d ago

A Mac can run vole runner today, because the job still executes in a Linux container — inside a podman machine or Docker Desktop VM. Nothing in ci/agent or ci/container assumes Linux on the host, but nothing checks the macOS-specific failure modes either, and a Mac can never run a job that needs macOS itself (Xcode builds, codesigning, a .pkg).

Two separate problems:

The runner on a Mac, with a container VM

  • Verify and bound the shared-path assumption: bind mounts only work under paths the VM shares ($HOME, /Users, /private, /var/folders for podman machine; /Users, /Volumes, /private, /tmp, /var/folders for Docker Desktop). Check --dir and the job tree at startup and fail with a sentence, not a runtime error from the middle of a job.
  • Probe should say “start it with podman machine start” when <runtime> info fails on darwin.
  • Confirm --userns keep-id, --tmpfs, --pids-limit, and --security-opt no-new-privileges behave the same through the VM, and that the bind-mounted job tree is writable by the job’s --container-user.
  • Say in the docs that job I/O goes through virtiofs and is much slower than a Linux runner, and that --dir on an external volume is not shared.
  • vole runner under a LaunchAgent, so it starts with the session and survives a logout.

Native macOS jobs (a design decision, not a bug)

  • Decide whether Vole CI should execute steps on the runner host at all. That is what building macOS software requires, and it runs repository code directly on the Mac instead of in a container, so it is a change to the runner’s trust boundary and needs its own design: an explicit runs-on label only a host job may ask for, no secrets by default, and a documented “this machine is not sandboxed” answer.

Acceptance criteria:

  • A Mac runner completes a job from a real repository, and a --dir outside the shared set fails at startup with an explanation.
  • The docs say what a Mac runner can and cannot run.
  • The native-job question has an answer recorded here before anyone writes the code.

Comments (5)

keenan 12d ago

Include a short spike to see if we can run MacOS virtual machines with Tart (https://tart.run/).

keenan 8d ago

Tart spike results (on an Apple M1 Pro, macOS, Hypervisor.framework available):

  • Tart installs from the openai/tools tap (brew install openai/tools/tart); it was transferred there from Cirrus Labs and is no longer at cirruslabs/cli. On Homebrew 7.x the tap must be trusted first (brew trust --cask openai/tools/tart).
  • tart --version → 2.42.0. It runs natively with no kernel extensions: sysctl kern.hv_support is 1, so it uses Hypervisor.framework.
  • tart create <name> --from-ipsw <path|"latest"> builds a full macOS VM, and tart create <name> --linux builds a Linux VM. tart run --no-graphics runs headless; tart ip reports the guest address for SSH.
  • --disk accepts a remote OCI image (e.g. ghcr.io/cirruslabs/xcode:16.0:ro), so a registry-hosted macOS toolchain image is the natural unit for a “native macOS” CI job: same pattern as the container images Vole already pulls.

Conclusion: Tart is the right substrate for the “native macOS jobs” half of this issue, not a Linux container VM. A Tart macOS VM is what can run Xcode builds, codesigning, and .pkg assembly. The open question is the trust boundary (the issue’s second half): running repository code directly on the Mac, explicit runs-on label, no secrets by default, documented “not sandboxed”.

keenan 7d ago

Decision: jobs never run on the runner host.

The macOS virtualization work has one rule: repository code runs only inside a container or a VM, never directly on the runner host. A “macOS job” means a job whose steps run inside a macOS VM (Tart, today), launched by the runner the same way it launches an OCI container for a Linux job. There is no “native host job” and there will not be one, so the trust boundary is unchanged and the “not sandboxed” caveat does not apply.

This closes the “Native macOS jobs (a design decision, not a bug)” half of the issue. The remaining work is making the runner able to drive a macOS VM behind the same step-execution boundary it already has for containers.

keenan 7d ago

Spike: how to run macOS jobs without running anything on the host.

Confirmed the decision: jobs never run on the runner host. The question is which execution surface the runner drives, and I explored both Tart and the underlying Virtualization.framework.

Findings

1. Tart is nearly a drop-in for the container model

Tart 2.42 (from the openai/tools cask — Cirrus transferred it) now exposes a container-shaped surface, not just “run a VM and SSH in”:

  • tart pull ghcr.io/cirruslabs/macos-sonoma-xcode:latest — OCI registry pull, the same registry model the runner already uses for container images. The Cirrus macOS images carry the Tart Guest Agent.
  • tart create --from-ipsw <path|"latest"> — build a VM from a recovery IPSW.
  • tart run --no-graphics — headless, like docker run -d.
  • tart exec <name> <command> — run one command in the running VM, with -i/-t. This is the critical primitive: it maps to docker exec, and it exists because the Cirrus images ship the Tart Guest Agent. (A vanilla IPSW VM has no agent, so it would need one installed — a bootstrap step.)
  • --dir <[name:]path[:options]> — virtiofs directory sharing (macOS 13+ both sides), which is the analogue of the runner’s bind mount. Guest mounts it under /Volumes/My Shared Files.
  • tart ip, tart set --cpu/--memory, tart stop, tart delete.

Gaps versus the OCI model the runner assumes today (ci/container):

  • No --pids-limit, no --userns, no --security-opt no-new-privileges, no --tmpfs. A VM is a whole machine; those cgroup/DAC switches do not exist. --dir (virtiofs) is the only sharing primitive, and there is no :ro tmpfs equivalent.
  • tart exec output/exit-code semantics need verification against a real booted image (I could not pull one here — the Cirrus macOS images are ~63 GB and that download is not feasible in a spike session).

2. Alternative: embed Virtualization.framework directly

Apple’s Virtualization.framework is what Tart builds on, and it has a mature Go binding: github.com/Code-Hex/vz/v2 (v2.x). This would let vole runner launch a macOS VM as an in-process library call on darwin instead of shelling out to a tart binary.

Trade-offs:

  • Pro: no external tart dependency; one binary stays true (the binding is cgo’d, darwin-only, so it compiles only into the darwin build).
  • Con: we re-implement Tart’s registration, guest-agent protocol, virtiofs mount, and image-cache logic. Tart has already solved those; a direct framework integration is a much larger surface to own and keep aligned with Apple’s API.

Options to support a “macOS job”

A. A tart runtime, peer of docker/podman/nerdctl. Add tart to the runtime allowlist and teach ci/container a second execution backend that maps Start→tart run --no-graphics, Exec→tart exec, Stop→tart stop, Probe→tart list/tart --version. This reuses the job model, the spool, the lease, and the SSH reporting unchanged. Isolation flags with no VM analogue are documented as no-ops or refused for VM jobs. Lowest risk, smallest change, keeps the binary only shelling out.

B. Embed vz (Virtualization.framework) in-process. The most “one binary” outcome, and the most work: own image handling, the guest-agent protocol, and virtiofs ourselves on top of vz. Justified only if shipping a tart binary is unacceptable and we want to drop the external dependency.

C. A distinct “VM job” schema concept (e.g. an image: that resolves to a VM and a runtime field that names tart). More explicit than A but adds workflow schema we have to teach and validate, with little benefit over A, since A already fits the --container-runtime knob.

Recommendation

Go with A: treat Tart as another container runtime. The CLI shape is close enough that the job model and everything around it (lease, spool, log stream, credential boundary) is untouched; only ci/container gains a Tart backend. This also matches the existing --container-runtime flag, so vole runner --container-runtime tart --label mac already reads as the answer.

Open questions before the implementation (not blockers for the runner-on-Mac checks already listed in the issue):

  1. Verify tart exec faithfully passes stdout/stderr and the exit status (needs a small bootable guest with the agent — a Linux cloud image works and avoids the 63 GB macOS download).
  2. The guest-agent bootstrap story for a non-Cirrus image (vanilla IPSW has no agent); for the first cut, require a Cirrus/agent-carrying image and document it.
  3. Decide the isolation story: which --container-* flags are refused vs. ignored for a VM job, and say so in the run record.
keenan 7d ago

tart exec verified end-to-end against a booted VM.

I pulled ghcr.io/cirruslabs/ubuntu:24.04 (3.1 GB compressed, the Linux guest that carries the Tart Guest Agent), cloned it, ran it headless, and drove it the way the runner would. Results:

  • stdout: captured (tart exec vm echo hello → hello).
  • stderr: written to stderr (redirectable independently of stdout).
  • exit status: propagated faithfully — true→0, false→1, exit 42→42.
  • stdin: -i forwards it (echo x | tart exec -i vm cat → x).
  • no PTY by default (like docker exec without -t); -t is opt-in.
  • merged stdout+stderr: works, but the two streams are not strictly interleaved (B/stderr can precede A/stdout). The runner already merges both into one log writer, so this is acceptable, but sequence-sensitive logs should not rely on exact cross-stream ordering.

Differences from docker exec the backend must account for:

  • Env is not forwarded. tart exec has no --env/-e; the host’s CI, HOME, TMPDIR, etc. do not reach the guest (guest HOME=/home/admin). The runner either exports the job env in the command prefix or accepts that VM jobs set their own env.
  • No -w/workdir flag; the guest starts at /. The command itself must cd.
  • Directory sharing is --dir (virtiofs), not --volume. On a macOS guest it auto-mounts under /Volumes/My Shared Files; on a Linux guest it must be mounted manually (sudo mount -t virtiofs com.apple.virtio-fs.automount /mnt). Verified both directions: the guest wrote a file through the share and it landed on the host owned by the operator (uid 501), so the job tree is writable by the guest.

Net: the ci/container Tart backend maps docker exec → tart exec with only env/workdir passed in the command prefix, and docker run --volume → tart run --dir. The OCI-incompatible flags (--pids-limit, --userns, --security-opt no-new-privileges, --tmpfs) have no analogue and should be refused for VM jobs rather than silently ignored. This confirms option A from the spike (Tart as a peer runtime); the only remaining unknown specific to a macOS (not Linux) guest is whether the auto-mount path and agent behave identically, which needs a Cirrus macOS image (63 GB, out of scope for this spike).