Skip to content

Comments

Optimize Trivy vulnerability scanning with caching and OCI archive#4

Merged
miragecentury merged 1 commit intomainfrom
claude/update-vulndb-fSV7t
Feb 19, 2026
Merged

Optimize Trivy vulnerability scanning with caching and OCI archive#4
miragecentury merged 1 commit intomainfrom
claude/update-vulndb-fSV7t

Conversation

@miragecentury
Copy link
Contributor

Summary

This PR improves the Trivy vulnerability scanning step in the release workflow by adding caching for the vulnerability database and updating the image input format to use OCI archive syntax.

Key Changes

  • Added Trivy DB caching: Implemented GitHub Actions cache for ~/.cache/trivy to avoid re-downloading the vulnerability database on every workflow run, reducing scan time and improving efficiency
  • Updated Trivy input format: Changed from the deprecated --input flag to the oci-archive: URI scheme for specifying the container image source
  • Improved scan command: Removed the --input flag and restructured the command to use the modern OCI archive format

Implementation Details

  • Cache key includes runner.os and github.run_id to ensure proper cache isolation per OS and workflow run
  • Fallback restore keys allow cache hits across different workflow runs on the same OS
  • The OCI archive format (oci-archive:build/${IMAGE_NAME}.tar) is the recommended approach for scanning local container images with Trivy

https://claude.ai/code/session_01FovhL9GqcEehmbUDtPyt5Z

The image was built and saved as an OCI archive (via buildah push
oci-archive:...) but trivy was invoked with --input which only
accepts Docker-format tars. Switch to the oci-archive: image
reference so trivy correctly parses the OCI layout.

Also add a GitHub Actions cache step for ~/.cache/trivy so the
85 MiB vulnerability DB is not re-downloaded on every release run.

https://claude.ai/code/session_01FovhL9GqcEehmbUDtPyt5Z
@miragecentury miragecentury merged commit 014fac2 into main Feb 19, 2026
3 checks passed
@miragecentury miragecentury deleted the claude/update-vulndb-fSV7t branch February 19, 2026 20:51
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.

2 participants