-
Notifications
You must be signed in to change notification settings - Fork 125
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
Adding scan_results table for ScanResult model #57
Adding scan_results table for ScanResult model #57
Conversation
7196117
to
a94350e
Compare
Migration looks good to me, but I believe this needs an update to the db/schema.yml Will wait on approval from @simon3z with respect to ManageIQ/manageiq-providers-kubernetes#100 before merging. |
@Fryguy @enoodle yeah before merging we definitely have to finalize ManageIQ/manageiq-providers-kubernetes#100 |
a94350e
to
7dcda5e
Compare
@moolitayer @simon3z It seems that we got to a decision in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@simon3z As we discussed, I think you're right. We can have a |
7dcda5e
to
9568a18
Compare
@simon3z @roliveri @moolitayer PTAL I have added the new table |
We may want to add a |
create_table :last_scan_results do |t| | ||
t.string :last_scan_status | ||
t.string :last_scan_message | ||
t.belongs_to :resource, :polymorphic => true, :type => :bigint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would link this to the job that created the status. We could get the target resource through that. Is that enough to have the needed info of scan_type @roliveri ?
(I know that for ContainerManager::Scanning::Job
we always have OpenSCAP AND package analysis)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. Assuming the scan type based on the resource won't be enough. As I mentioned, going forward, different scans may be performed independently for the same resource, so they may be performed by different jobs. Even if we could obtain the scan type through the job, do job objects persist after the jobs have completed? If not, the link to the job could go stale while the scan results are still linked to the resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have different scan types in a vm scanning job? Anyway regardless the new table might be a better place to keep the scan_type
(and anything related to scan
and not directly to job
)
I still think the a link to the job would serve us (for example if we want to show last job info in container image screens). I don't see a purge or something that would delete job records but I might be missing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't had different scan types until now, so there's no concept of type in the scan job. However, I think we may need to rely on subclasses of Job more than we do now. The Job subclass could not only indicate the resource being scanned, but the type of scan as well. If the scanning process is significantly different for some types, it makes sense for them to have their own Job subclass.
I'm not saying we shouldn't link to Job. Only that we should make sure it will be there when we need it.
9568a18
to
5ed20ff
Compare
I updated this with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Once the tests are green, should be ok to merge.
5ed20ff
to
a59e78d
Compare
it belongs to an isomorphic "resource"
a59e78d
to
ec53a4c
Compare
So apparently the tables in
and rake doesn't really know how to build this task so it won't work to fix it. I ordered the table now, hopefully this will make the test green. |
Checked commit enoodle@ec53a4c with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Does |
@Fryguy No, Maybe I am not running it well. I tried from the main ManageIQ directory but it couldn't build the task. From the manageiq-schema plugin directory I got |
You need a fully raked up database to do it. If you've done RAILS_ENV=test bundle exec rake db:write_schema |
@Fryguy Thanks, this was working for me now. |
To support reporting and displaying the last OpenSCAP scan result for container images, as requested in ManageIQ/manageiq-providers-kubernetes#100