Skip to main content

Module forge_produced

Module forge_produced 

Source
Expand description

Convention for a remote forge step’s durable produced artifacts.

A remote build (e.g. the rusty_v8 musl build on a build-worker) writes its output tarball to a path inside the container. The container’s rootfs is destroyed when kamaji reaps the EXITED container — so if the camp daemon is down when the build finishes, the artifact is gone before boot-reconcile can retrieve it (R603-T4 surfaced this as Success-but-UNPUBLISHED).

The fix (R603-T5) is a host-persistent bind mount: forge Subprocess workloads mount [HOST_ROOT]/<forge_id> onto [CONTAINER_DIR], so a build that writes its produces under /yah/produced lands the bytes on the worker’s host filesystem. yubaba then reads them back from the host path ([host_path]) — which outlives container reaping — instead of the unreachable container rootfs.

The container-side path and the host root are a shared convention between three crates: the qed build_workload_spec that adds the mount, kamaji that binds it, and the yubaba handler that reads + reaps it. Keeping it here (the crate all three already depend on) is the single source of truth.

Constants§

CONTAINER_DIR
Conventional container-side directory a remote forge step writes its durable produced artifacts to. Bind-mounted onto a host-persistent dir.
HOST_ROOT
Host root under which each forge’s durable produced dir lives, one subdir per run: <HOST_ROOT>/<forge_id>/. yubaba owns this directory — it creates the per-forge subdir at deploy, serves reads from it, and reaps it on teardown / TTL sweep.

Functions§

durable_mount
The durable produced-dir bind mount for a forge run: host <HOST_ROOT>/<forge_id> → container CONTAINER_DIR, writable.
forge_id_from_ident
Forge mesh idents are forge.<id> (see WorkloadSpec::for_forge). Extract the bare <id>, or None for a non-forge ident.
host_dir
The host-persistent produced directory for one forge run.
host_path
Translate a container-side produced path to its durable host path for a given forge run. Returns None when container_path is not under CONTAINER_DIR (the caller then knows the artifact was not written to the durable location and won’t survive reaping), or when the relative path contains a .. component (a traversal attempt that could escape the per-forge dir — the reader must never serve a file outside it).
is_durable_path
True when path is (or is under) the conventional durable produced dir — the guard qed uses to enforce that declared produces land somewhere reap-durable.