Skip to content

fix(trivy): add PATH lookup for trivy binary; fix success rate integer division - #1299

Open
AruneshDwivedi wants to merge 1 commit into
eraser-dev:mainfrom
AruneshDwivedi:fix/trivy-path-lookup-and-success-rate
Open

AruneshDwivedi wants to merge 1 commit into
eraser-dev:mainfrom
AruneshDwivedi:fix/trivy-path-lookup-and-success-rate

Conversation

@AruneshDwivedi

Copy link
Copy Markdown

What's changed

Fixed two bugs in eraser:

  1. 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.

  2. 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

…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>

This branch has not been deployed

No deployments
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.

[BUG] Success Rate Incorrect - says 0% [BUG] trivy-scanner pod doesn't error when trivy binary cannot be found

1 participant