feat: add opt-in Trivy scanning to PR builds - #741
Draft
bschwedler wants to merge 2 commits into
Draft
Conversation
This was referenced Aug 11, 2026
Test Results2 140 tests 2 140 ✅ 7m 36s ⏱️ Results for commit 9c59d69. ♻️ This comment has been updated with latest results. |
Re-adds the PR-build Scan step split out of #722, behind a scan-image input defaulting to false. A scan costs roughly as long again as the build it follows -- ~4 minutes per job measured on images-connect content builds -- so imposing it on every caller's every PR is not a default anyone should inherit silently. Adds scan-fail-on-severity, unset by default. Without it the step could not fail a build even in principle, which is what made the previous always-on version pure cost: no --fail-on-severity, plus continue-on-error, means the result was a table in a collapsed log group. A caller that opts in can now also choose to gate on it. Pins trivy-version rather than tracking latest. setup-trivy logs "doesn't currently support caching the 'latest' version", so the default re-downloaded the binary on every job. Not wired to code scanning. Fork PRs get a read-only token and could not be granted security-events: write, and main only analyses latest versions, so PR-time uploads of older versions would have no baseline and would report every finding as new.
Same placement bug the native workflow had. PR builds also use `--strategy build --pull --load`, so only the last target of an image stays addressable by tag, and this workflow passes no --metadata-file to fall back on digests. Scanning before Test resolved stale tags and silently scanned published images. Renames to `Trivy Scan` to match the native workflow, where it has to be distinct from #715's Wiz scan.
bschwedler
force-pushed
the
feat/trivy-pr-build-scan
branch
from
August 11, 2026 19:10
370a449 to
9c59d69
Compare
| if: ${{ inputs.scan-image }} | ||
| uses: aquasecurity/setup-trivy@81e514348e19b6112ce2a7e3ecbafe19c1e1f567 # v0.3.1 | ||
| with: | ||
| version: ${{ inputs.trivy-version }} |
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.
Re-adds the PR-build
Scanstep split out of #722, behind ascan-imageinput defaulting tofalse.The always-on version this replaces couldn't fail a build even in principle — no
--fail-on-severity, pluscontinue-on-error— so it cost ~4 minutes per job on every PR in three repos and produced a table in a collapsed log group. Now a caller opts in, andscan-fail-on-severitylets one that does actually gate on the result.trivy-versionis pinned rather than trackinglatest, becausesetup-trivylogs "doesn't currently support caching the 'latest' version" — the previous default re-downloaded the binary on every job.Not wired to code scanning. Fork PRs get a read-only token and can't be granted
security-events: write, and main only analyses latest versions, so PR-time uploads of older versions would have no baseline and would report every finding as new.