Repository navigation
ci(security): speed up PR Trivy scan (collapse runs + reuse warm cache) - #910
Merged
Merged
Conversation
The Security Scan job ran Trivy three times over the same image tar (HIGH/CRITICAL, MEDIUM, SBOM), each re-installing Trivy, re-parsing the tar and cold-pulling the vuln DB — ~9 min of the job's ~11.5 min. Merge the two vuln tables into one severity list, and let the SBOM step reuse the warm Trivy install + DB (skip-setup-trivy + TRIVY_SKIP_*_DB_UPDATE) instead of cold-pulling again. Both steps stay non-blocking; the authoritative CVE gate remains the nightly vulnix scan. Path-gating was considered and rejected: an unchanged image can still be hit by a newly-disclosed CVE, so every PR keeps scanning. Refs: #109
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Speeds up the
Security Scanjob inci.yml, which was ~11.5 min of a ~14 min PR CI run (83% of wall-clock, on the critical path vianeeds: build-image).Root cause (from run 28870696086): Trivy ran three times over the same image tar — HIGH/CRITICAL (3m02s), MEDIUM (3m03s), SBOM (2m42s) — each re-installing Trivy, re-parsing the tar and cold-pulling the vuln DB.
Changes
severity: HIGH,CRITICAL,MEDIUMinvocation — removes a whole Trivy run.skip-setup-trivy: true+TRIVY_SKIP_DB_UPDATE/TRIVY_SKIP_JAVA_DB_UPDATE, since SBOM generation needs neither a second Trivy install nor the vuln DB.Both steps remain non-blocking (
exit-code: 0). The authoritative blocking CVE gate is unchanged — the nightlyvulnixscan insecurity-scan.yml.Why not path-gate?
Considered and rejected (per discussion in #109): an unchanged image can still be hit by a newly-disclosed CVE, so every PR keeps scanning. This PR makes the scan cheap instead of conditional.
Note
.trivyignorenow also filters MEDIUM findings (previously HIGH/CRITICAL only). Harmless — awareness-only output, and no.trivyignoreentries are MEDIUM-specific.Refs: #109