--exit-code
is overloaded
#7915
chrisnovakovic
started this conversation in
Bugs
Replies: 2 comments
-
I think it makes sense just reclassifying as a enhancement request not as bug |
Beta Was this translation helpful? Give feedback.
0 replies
-
I don't see the behavior. Also, I confirmed the value is used only for security findings. trivy/pkg/commands/operation/operation.go Line 126 in bdfcc19 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
The documentation for the
--exit-code
option saysbut this value is also used when errors occur that are not related to security findings. The most common example I've encountered is when the databases fail to update (which is happening a lot lately - see #7668), but from
pkg/plugin/plugin.go
it looks like the same value is also used for plugin execution failures. This overloading makes it hard to distinguish between failures that might be resolved with a retry and failures that won't be.It seems something like this has been considered before because there's also an
--exit-code-eol
option:so perhaps it's simply a case of adding a new option (
--exit-on-db-error
?).Desired Behavior
At a minimum, different exit codes are used when encountering security issues and encountering other run-time failures, for example database update errors.
Actual Behavior
Trivy exits with exit code 1 (or whatever the value of
--exit-code
is set to) for several reasons.Reproduction Steps
Target
Container Image
Scanner
Vulnerability
Output Format
None
Mode
Standalone
Debug Output
Operating System
Ubuntu 22.04
Version
Checklist
trivy clean --all
Beta Was this translation helpful? Give feedback.
All reactions