chore: sync stdout before container is stopped#2825
chore: sync stdout before container is stopped#2825daanschipper wants to merge 1 commit intoaquasecurity:mainfrom
Conversation
f745d70 to
8f4cefe
Compare
PT-GD
left a comment
There was a problem hiding this comment.
Minor refactoring to remove duplication. I wonder if there's an opportunity to have the trivy CLI format the output based on the result condition and sync, saving the alternate redirection logic?
tests/envtest/testdata/fixture/replicationcontroller-expected-scan.yaml
Outdated
Show resolved
Hide resolved
|
Fixed the duplication. I'm not so sure about changing the redirection logic. |
The container is otherwise stopped before the result of the scan is outputted to stdout, resulting in errored scan jobs.
|
I've taken a further look at changing the cli redirect. For non compressed scan output that could work as writing the output is part of the trivy command. However, for the compressed output that does not seem possible, no option to output compressed and encoded string exists in the cli. It could be possible with a plugin https://trivy.dev/docs/latest/guide/plugin/user-guide/#output-mode-support. However, that seems a bit much for me to implement at the moment. |
The container is otherwise stopped before the result of the scan is outputted to stdout, resulting in errored scan jobs.
With #2591 the
syncwas removed, however, the command is needed to ensure the output of the scan jobs are outputted in full to stdout. Without the command the result of the job can be 'cut off' halfway as the container is already stopped, resulting in errored scan jobs without any message: