Skip to content

fix(ci): aggressively reclaim disk before Trivy (no-space DB download failure) - #1728

Merged
POWERFULMOVES merged 1 commit into
mainfrom
fix/ghcr-trivy-disk-reclaim
Jun 6, 2026
Merged

POWERFULMOVES merged 1 commit into
mainfrom
fix/ghcr-trivy-disk-reclaim

Conversation

@POWERFULMOVES

@POWERFULMOVES POWERFULMOVES commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Problem

GHCR run 27042677318Build archon built + pushed successfully, but the Trivy gate failed with:

FATAL  failed to download vulnerability DB: ... no space left on device

Trivy couldn't fetch its ~95 MB vuln DB on kvm4-1 — it never scanned a package. This is a false-negative gate: the image is fine (CVE dep bumps from #1726 present), but the gate fails for an infra reason, masking the real security signal. 3rd disk-related GHCR failure (after #1717 kvm2 deadlock, #1719 /tmp stereoscope sweep).

Fix

Free disk space before Trivy only pruned BuildKit cache + dangling images. Strengthen it (the image is re-pulled in the next step, so removing unused images is safe):

Deliberately excludes volume pruning — these runners may co-host fleet data-store volumes (neo4j/supabase-db/etc.); removing volumes could destroy a temporarily-stopped service's data. Image-layer reclaim frees far more than the DB needs.

Verification

YAML parses (build-publish 31 steps). Unblocks Trivy verification of the archon/open-notebook CVE remediation (#1726).

Note (operator)

kvm4 self-hosted runners are chronically disk-tight — this is a workflow-side mitigation; the runner hosts need disk hygiene (old _work dirs, caches). Flagged for operator follow-up.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Optimized disk space cleanup in CI/CD pipeline for improved reliability on resource-constrained runners.
    • Enhanced removal of temporary and cache files to prevent insufficient space errors.
    • Added diagnostic logging for disk usage monitoring.

… failure)

GHCR run 27042677318: 'Build archon' built+pushed fine but the Trivy scan
FAILED with 'failed to download vulnerability DB: ... no space left on device'
on kvm4-1 — the scanner could not fetch its ~95MB DB. False-negative gate
(image is fine, gate fails for infra reasons), masking the real CVE signal.

The prior step only pruned BuildKit cache + dangling images. Strengthen it:
- docker image prune -af (image is RE-PULLED in the next step, so removing all
  unused images is safe; reclaims GBs of layers)
- drop stale/corrupt .cache/trivy DB so the download restarts clean
- sweep /tmp SBOM/scan scratch (stereoscope-*, sbom-action-*, trivy-*) that
  docker prune does not reclaim (same class as #1719's build-host sweep)
- log df -h before/after for observability

Deliberately NOT 'docker volume prune' — these runners may co-host fleet
data-store volumes; pruning volumes could destroy stopped-service data.

Unblocks Trivy verification of the archon/open-notebook CVE dep bumps (#1726).
kvm4 runners are chronically disk-tight — flagged for operator hygiene.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Too much diff to scan? Review this PR in Change Stack to start with the highest-impact changes.

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cbc24489-7ba6-4ac9-8742-f6bbca61f532

📥 Commits

Reviewing files that changed from the base of the PR and between c1e7dae and a8080bc.

📒 Files selected for processing (1)
  • .github/workflows/integrations-ghcr.yml

📝 Walkthrough

Walkthrough

The PR updates the "Free disk space before Trivy" step in the integrations-ghcr GitHub Actions workflow to reclaim root filesystem space more aggressively on self-hosted runners. It now logs disk usage before and after, performs aggressive Docker pruning, explicitly deletes cached Trivy database and fanal directories, and expands temporary directory cleanup to include Trivy scratch artifacts.

Changes

Trivy Pre-Scan Disk Cleanup

Layer / File(s) Summary
Free disk space and cache cleanup
.github/workflows/integrations-ghcr.yml
The pre-scan disk cleanup step now logs root disk usage, runs aggressive Docker builder/image/container pruning with -af to remove all unused layers, explicitly deletes Trivy cache directories (.cache/trivy/db and .cache/trivy/fanal) to avoid corrupted cache after space failures, and expands /tmp scratch cleanup to include trivy-* directories alongside existing scan and SBOM artifacts.

Possibly related PRs

  • POWERFULMOVES/PMOVES.AI#1719: Both PRs extend the same integrations-ghcr workflow's /tmp cleanup to remove Trivy scratch directories on self-hosted runners.
  • POWERFULMOVES/PMOVES.AI#316: Both PRs modify the same GHCR Trivy CI workflow to address out-of-space failures by pruning Docker caches and Trivy data before scanning.
  • POWERFULMOVES/PMOVES.AI#1651: Both PRs modify integrations-ghcr.yml's disk cleanup steps to free space by pruning Docker and Trivy artifacts on self-hosted runners.

Poem

🐰 A runner once gasped for some space,
So we scrub every cache in the place!
Trivy's DB gone, Docker layers too,
/tmp scratches vanish on cue,
Now scans sail free with room to embrace! 🚀

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete relative to the template. The required 'Testing' section with commands is entirely missing, and required checkbox items are not addressed. Add a 'Testing' section documenting how the workflow changes were verified, complete the required checklist items, and indicate whether contract/documentation updates are needed.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: an aggressive disk reclaim before Trivy to fix a no-space DB download failure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ghcr-trivy-disk-reclaim

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a8080bcd83

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# Sweep the SBOM/scan scratch that the docker prune does NOT reclaim
# (same class as the build-host sweep in #1719) — frees the root volume.
for pat in 'stereoscope-*' 'sbom-action-*' 'trivy-*' 'codeql-packaging*' 'codeql.*'; do
find /tmp -maxdepth 1 -name "$pat" -mtime +0 -exec rm -rf {} + 2>/dev/null || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the age gate from the Trivy scratch sweep

In the build-publish job, this sweep runs immediately after Generate SBOMs and before the Trivy DB pull. find -mtime +0 only matches entries older than a full day (checked GNU findutils 4.9.0 locally: a newly-created stereoscope-* dir was not printed, a 25h-old one was), so any large /tmp/stereoscope-* or /tmp/sbom-action-* tree just left by the SBOM scan is skipped. On the disk-full path this change is trying to fix, that leaves the root volume full and the following docker pull/Trivy DB download can still fail with no space left on device.

Useful? React with 👍 / 👎.

@POWERFULMOVES
POWERFULMOVES merged commit 5b82156 into main Jun 6, 2026
34 checks passed
@POWERFULMOVES
POWERFULMOVES deleted the fix/ghcr-trivy-disk-reclaim branch June 6, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant