Skip to content

fix(trivy): fail fast when trivy binary is not found - #1230

Open
AruneshDwivedi wants to merge 2 commits into
eraser-dev:mainfrom
AruneshDwivedi:fix/trivy-binary-not-found
Open

fix(trivy): fail fast when trivy binary is not found#1230
AruneshDwivedi wants to merge 2 commits into
eraser-dev:mainfrom
AruneshDwivedi:fix/trivy-binary-not-found

Conversation

@AruneshDwivedi

Copy link
Copy Markdown

Fixes #1149

When the trivy binary at /trivy cannot be found, the scanner previously
logged an error and continued processing, silently swallowing the failure.
This made it impossible to distinguish between a missing binary and a
successful scan.

Add a pre-flight os.Stat check in main() to exit immediately with a
clear error message when the trivy binary is missing.

[BUGFIX] trivy: fail fast when trivy binary is not found at /trivy

When the trivy binary at /trivy cannot be found, the scanner previously
logged an error and continued processing, silently swallowing the
failure. This made it impossible to distinguish between a missing
binary and a successful scan.

Add a pre-flight os.Stat check in main() to exit immediately with a
clear error message when the trivy binary is missing.

Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
- utils.GetConn: wrap grpc.DialContext with a 30-second timeout context
  so the collector/remover fail fast instead of hanging indefinitely when
  the CRI socket is inaccessible (fixes eraser-dev#1014)
- trivy scanner: add pre-flight os.Stat check for /trivy binary in main()
  so the pod exits immediately with a clear error when the binary is
  missing instead of silently logging and continuing (fixes eraser-dev#1149)

Fixes eraser-dev#1014
Fixes eraser-dev#1149

Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
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] trivy-scanner pod doesn't error when trivy binary cannot be found

1 participant