Etapa G: Go compile usa GOCACHE/GOTMPDIR en /src (disk), no en el tmpfs /tmp

telegraf/vault (binarios Go gigantes) fallaban en el LINK con 'mapping output file failed: no space
left on device': el sandbox monta --tmpfs /tmp (~½ RAM) y el GOCACHE + temp del linker desbordan ese
tmpfs aunque el disco tenga 18G libres. Ahora GOCACHE/GOTMPDIR van a /src (árbol de fuentes bind-
montado, en disco, per-build, lo limpia el watchdog; no se sella). No entra al hash de input (fase
generada) ⇒ no re-sella el corpus Go.
This commit is contained in:
2026-06-27 03:17:50 -04:00
parent 55b47709d4
commit b3be6c8e3c
+10 -2
View File
@@ -744,9 +744,17 @@ fn resolve_phases(recipe: &Recipe, src: &Path) -> hammer_core::Result<Phases> {
} else {
flags.clone()
};
// GOCACHE/GOTMPDIR en /src (disk-backed, per-build, lo limpia el watchdog), NO en
// /tmp: el sandbox monta `--tmpfs /tmp` (~½ RAM); un proyecto Go ENORME (telegraf,
// vault) desborda ese tmpfs con sus objetos compilados + el temp del linker al mapear
// el binario → "link: mapping output file failed: no space left on device" aunque el
// disco tenga sitio. /src es el árbol de fuentes bind-montado (en disco) y no se sella
// (sólo /out) ⇒ inocuo. GOTMPDIR debe pre-existir. No entra al hash de input (es la
// fase generada, no un campo de la receta) ⇒ no re-sella el corpus Go.
Some(format!(
"export GOCACHE=/tmp/gocache GOPATH=/tmp/gopath GOTOOLCHAIN=local \
CGO_ENABLED=0 GOFLAGS=-mod=vendor GOPROXY=off GOBIN=/out/usr/bin; \
"export GOCACHE=/src/.gocache GOTMPDIR=/src/.gotmp GOPATH=/tmp/gopath \
GOTOOLCHAIN=local CGO_ENABLED=0 GOFLAGS=-mod=vendor GOPROXY=off \
GOBIN=/out/usr/bin; mkdir -p /src/.gotmp; \
go install -trimpath -ldflags=-buildid= {pkg}"
))
}