Repository navigation
fix(trivy): add PATH lookup for trivy binary; fix success rate integer division - #1299
Open
AruneshDwivedi wants to merge 1 commit into
Open
AruneshDwivedi wants to merge 1 commit into
AruneshDwivedi wants to merge 1 commit into
Conversation
…r division - Add findTrivyBinary() to look up trivy in PATH if /trivy not found (fixes eraser-dev#1149) - Fix integer division in success rate calculation causing 0% reports (fixes eraser-dev#1163) Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
AruneshDwivedi
requested review from
ashnamehrotra,
pmengelbert and
sozercan
as code owners
October 7, 2026 10:12
This branch has not been deployed
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's changed
Fixed two bugs in eraser:
trivy binary lookup ([BUG] trivy-scanner pod doesn't error when trivy binary cannot be found #1149) - Added findTrivyBinary() helper that first checks /trivy path, then falls back to PATH lookup. This ensures the scanner works when trivy is installed system-wide but not at the hardcoded path.
Success rate calculation ([BUG] Success Rate Incorrect - says 0% #1163) - Fixed integer division bug where successAndSkipped/Desired was doing integer division before converting to float64, causing the result to always be 0 when there were any failures. Now properly casts to float64 before dividing.
Why
The integer division bug caused Eraser to report 0% success rate even when most pods succeeded, because Go integer division truncates. The trivy PATH lookup ensures the scanner can find trivy even when it's installed in a non-standard location.
Fixes #1149
Fixes #1163