fix(sys-ctl-hlth-runtime): give the scanners a writable temp dir and keep the workspace databases outside the checkout

PR #1326 CI failed in two places:

- The vulnerability-db job stopped on `unable to create listing temp file:
  open /tmp/grype-db-listing…: permission denied`. The repository runs the
  engines as `docker run --user <uid>:<gid>`, and the Grype and Syft images
  set no User and WorkingDir /tmp, which only root may write. The dry-run
  mirror scan failed the same way: 156 Syft errors and the Grype database.
  Every engine now gets TMPDIR pointing at its writable /work mount.
- Every workspace job died in `make system-purge`: `git clean -fdX` could
  not remove build/vulnerability-db, because the job bound that directory
  as its own mount inside the mounted checkout. On GitHub the workspace job
  now keeps its databases under ${RUNNER_TEMP}, outside the checkout; act
  keeps the shared host directory.

Part of #1324

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-11-01 08:37:10 +01:00
1 parent b46f7fadfd
commit 3531b95de0
4 files changed
+25 -6

No files matched your search

@@ -1049,6 +1049,19 @@ class TestCommands(TestCase):
step = SCRIPT.trivy_step(self.layout, "trivy:1", self.host, _config())
self.assertIn("/:/host:ro", step.argv)
def test_every_engine_writes_its_temp_files_to_the_work_mount(self):
for engine in ("trivy", "grype", "osv", "syft"):
with self.subTest(engine=engine):
argv = SCRIPT.run_argv(
self.layout, engine, f"{engine}:1", [], target=None, extra_env={}
)
self.assertIn("TMPDIR=/work", argv)
self.assertIn("/var/cache/v/run:/work", argv)
def test_the_grype_database_update_writes_its_listing_to_the_work_mount(self):
(step,) = SCRIPT.db_steps("grype", self.layout, "grype:1")
self.assertIn("TMPDIR=/work", step.argv)
def test_a_container_scan_reads_the_docker_socket_read_only(self):
step = SCRIPT.trivy_step(self.layout, "trivy:1", self.container, _config())
self.assertIn("/var/run/docker.sock:/var/run/docker.sock:ro", step.argv)