fix: cache the image scan's two databases apart, and show what each scan covered #101

Merged
bot-claude merged 1 commit from fix/trivy-db-cache into main 2026-11-09 16:53:56 +00:00
Collaborator

Image jobs re-downloaded Trivy's databases far more than needed: one cache key held both and was saved only on a passing job, so the first image of the day decided its content. Java images (ci-runner, cluster-ops) re-fetched the Java database every run, about 5 minutes each, and a scan that found something threw its download away.

  • trivy-db-<day> and trivy-java-db-<day> are separate entries, restored from the newest; each is saved only when Trivy actually fetched it (scan.sh downloads), even when the scan fails.
  • Every Image job prints trivy scanned: <type> <count>, … from Trivy's report and warns about any target it has no data for; the docs list which database covers which language.

Verified: just lint test (548 bats) green; live on devops/image#217 — see comment.

Session: 60ac4614-d609-4e43-a004-27bdaf30476c

Image jobs re-downloaded Trivy's databases far more than needed: one cache key held both and was saved only on a passing job, so the first image of the day decided its content. Java images (ci-runner, cluster-ops) re-fetched the Java database every run, about 5 minutes each, and a scan that found something threw its download away. - `trivy-db-<day>` and `trivy-java-db-<day>` are separate entries, restored from the newest; each is saved only when Trivy actually fetched it (`scan.sh downloads`), even when the scan fails. - Every Image job prints `trivy scanned: <type> <count>, …` from Trivy's report and warns about any target it has no data for; the docs list which database covers which language. Verified: `just lint test` (548 bats) green; live on devops/image#217 — see comment. Session: 60ac4614-d609-4e43-a004-27bdaf30476c
fix: cache the image scan's two databases apart, and show what each scan covered
All checks were successful
ci: reusable-pipeline / CI Pipeline (pull_request) Successful in 1m0s
6a2daeb302
One key held both databases and was saved only when the job succeeded, so the first image of the day decided its content: Java images re-downloaded the Java database on every run, and a scan that found something threw its download away. Each database now has its own entry, saved whenever Trivy fetched it and only then.
Every scan now prints the package types Trivy found and warns about any it has no data for, so a language that goes unscanned shows up.

Session: 60ac4614-d609-4e43-a004-27bdaf30476c
bot-claude force-pushed fix/trivy-db-cache from 6a2daeb302
All checks were successful
ci: reusable-pipeline / CI Pipeline (pull_request) Successful in 1m0s
to 3ffeaad256
All checks were successful
ci: reusable-pipeline / CI Pipeline (pull_request) Successful in 1m35s
ci: reusable-pipeline / CI Pipeline (push) Successful in 56s
2026-11-09 16:20:48 +00:00
Compare
Author
Collaborator

Live on devops/image#217 (3 runs, ci-runner / cluster-ops / squid):

  • run 1: each saved what Trivy fetched (trivy downloaded: db,java-db on ci-runner, db on squid); 3 parallel saves of one key all succeeded.
  • runs 2-3: trivy downloaded: none, both entries restored, scans 0-2 s instead of up to 414 s.
  • coverage line: trivy scanned: debian 1, gobinary 6, node-pkg 144, python-pkg 2 on ci-runner.
    The retry path did not trigger live (no ghcr break in these runs); it is covered by bats only.

Session: 60ac4614-d609-4e43-a004-27bdaf30476c

Live on devops/image#217 (3 runs, ci-runner / cluster-ops / squid): - run 1: each saved what Trivy fetched (`trivy downloaded: db,java-db` on ci-runner, `db` on squid); 3 parallel saves of one key all succeeded. - runs 2-3: `trivy downloaded: none`, both entries restored, scans 0-2 s instead of up to 414 s. - coverage line: `trivy scanned: debian 1, gobinary 6, node-pkg 144, python-pkg 2` on ci-runner. The retry path did not trigger live (no ghcr break in these runs); it is covered by bats only. Session: 60ac4614-d609-4e43-a004-27bdaf30476c
bot-claude changed title from WIP: fix: cache the image scan's two databases apart, and show what each scan covered to fix: cache the image scan's two databases apart, and show what each scan covered 2026-11-09 16:53:49 +00:00
bot-claude deleted branch fix/trivy-db-cache 2026-11-09 16:53:56 +00:00
Sign in to join this conversation.
No reviewers
No labels
needs-human
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cjournois/reusable-pipeline!101
No description provided.