-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export results per family scan #304
Conversation
Architecturally this is quite different to how I expected us to implement this. The channels and go routine stuff that were added as wrappers on in the job manager where a temporary solution for abort until we can fix up the code in kubeclarity to support cancelable contexts better, I don't think its a good idea to use that for the result processing. When discussing this previously I expected the presenter to be passed down to or be a part of the family logic. Personally I think it should be part of the family logic because each family can then understand how to present its own report format, and it would be configurable with different options per family e.g.
or
However this is a more significant change, and refactor requiring each family to be responsible for a set of "export"/"presenter" plugins. A shortcut which achieves close to the same thing is to pass the presenter and state interfaces down to the families as an input, when we create the family e.g. it can be an input: "vulnerabilities.New(ctx, config.Vulnerabilties, presenter, statemanager)". Then in the Run function for the specific family, after its run all scan jobs and merged the results, it can call the correct function on the presenter with the report, and any errors before returning to the family manager flow. This works well with the progress tracking stuff too, as "statemanager.MarkInProgress" for a specific family can be called as the first function call of the family Run function making it much more obvious whats happening from my perspective. It also means we can get rid of a lot of the type casting in the presenter because the results will come straight from the specific family to the specific family export function without going through the FamilyResults object. |
@sambetts-cisco I do not recall a discussion regarding this. The current implementation was left as is, so the CLI is still responsible for the presenting/exporting as before. I only made it more granular. |
I don't like the addition of more channels and monitoring in this PR, I would much prefer the families to accept an interface which can be called when starting a new family and exporting results, even if its just a two functions "MarkInProgress" and "ExportFamilyResult" like you've created. I don't think more go routines and channels is the right solution here. Like I said the go routine in the family manager was a temporary solution as it was.
|
Decided to move the exporting logic inside the family logic |
Couple of small comments, but overall the code looks great much cleaner |
Export scan results when family finish scanning, and not after all family scan is completed like today.
This will make the scan progress more informative and granular. Also mark in progress for each family scan
Type of Change
[* ] New Feature