fix(sbom-scanner): confine grype scratch so /tmp stops filling up #38
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Motstandskraft/spam!38
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/sbom-scanner-tmp-accumulation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The sbom-scanner was failing with
no space left on devicewhen writing the downloaded SBOM to/tmp:The Go code cleans up its own per-scan dir reliably (
defer os.RemoveAll(tmpDir)), so this looked confusing — but the cleanup only covered our dir.grypewas invoked withoutTMPDIRset, so it inherited the pod'sTMPDIR=/tmpand wrote its cataloging / DB-extraction temp files directly into/tmp, outside the per-scan dir. Those leftovers accumulated across every job for the pod's whole lifetime until/tmpfilled — the failure just happened to surface on our own small SBOM download.Fix
TMPDIRat the per-scan dir so its scratch is deleted with the scan, and at the disk-backed grype cache dir fordb updateso the DB tarball extraction never touches/tmp.sbom-scan-*orphans at startup — left behind when a container is OOM-killed mid-scan, since the emptyDir survives container restarts and thedefernever ran.homevolume mount (/home/runner→/home/scanner) so$HOMEis writable rather than sitting on the read-only root fs.The
/tmptmpfs stays at 256Mi: it only holds one scan's artifacts (SBOM + grype result, which the codebase documents can exceed 50 MB for EOL distros), and cross-job accumulation is now prevented at the source rather than by growing the volume.🤖 Generated with Claude Code