-
Notifications
You must be signed in to change notification settings - Fork 63
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
Image scanning: Add image name to task name #105
Conversation
@simon3z @moolitayer Please review |
@zakiva please check if this is OK for Einat as well, she needs this for her tests. |
@zakiva can we avoid reloading the image by passing it's name in check_policy_prevent? |
@@ -175,11 +175,12 @@ def scan_job_create(entity) | |||
|
|||
def raw_scan_job_create(target_class, target_id = nil, userid = nil) | |||
target_class, target_id = target_class.class.name, target_class.id if target_class.kind_of?(ContainerImage) |
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.
@moolitayer do you know in what cases this check is relevant? I might need to update the target_name as well in case we pass it through check_policy_prevent
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.
So this is a little confusing:
we used to pass an actual image object - not class and id. Then we wanted to move to class and id (to prevent queue serialization) but we wanted to be backward compatible with any queue items created by the old code that remain after upgrade.
Can you add as part of this PR a comment above this line
# maintain backward compatibility pre https://github.com/ManageIQ/manageiq/pull/13722
(for the next person reading this code)
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.
@moolitayer thanks, done
cc @epacific1, changes are coming ❄️ |
@moolitayer yes, I think it's possible. Please see a small related question in line. |
01d2295
to
3cdbf2d
Compare
@moolitayer PTAL |
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.
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.
nice 👍
target_class, target_id = target_class.class.name, target_class.id if target_class.kind_of?(ContainerImage) | ||
def raw_scan_job_create(target_class, target_id = nil, userid = nil, target_name = nil) | ||
# maintain backward compatibility pre https://github.com/ManageIQ/manageiq/pull/13722 | ||
if target_class.kind_of?(ContainerImage) |
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.
@moolitayer @cben can't we drop this entirely for 5.9? Maybe we can fail if target_class
is an instance instead of a class name.
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 can if you decide we can ;-)
Half a year passed since the code stopped queueing AR instances, but for a user upgrading from last release, it's still simultaneous queueing & dequeing side change, they'll might have some scans with AR instances queued.
IMHO it's no big deal to drop a few scans.
Or could keep this compat in Gaprindashvili release and drop entirely in H release...
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.
@moolitayer @cben if this is here to be backward-compatible with 4.2 then we can drop it in 4.6 (again, let's fail gracefully with a meaningful error message).
Let me know if I am missing something (e.g. version assumptions are incorrect, etc.).
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.
Oh you're right, I thought it didn't make it into fine, but fine-1 was already queueing event_target.class.name, event_target.id
and dequeuing with defensive if target_class.kind_of?(ContainerImage)
.
[upstream cheatsheet for this conversation: 5.9 & 4.6 both refer to master/Gaprindashvili, 4.5 to Fine, 4.2 to Euwe.]
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.
This fix is targeted for 4.5 zstream. Can we keep the check in this one for simplicity and remove it from master? (@simon3z maybe that is what you are suggesting but I'm not sure)
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.
@simon3z We can merge this PR to master as is and backport it. Then, I will send a separate PR to drop this check on master.
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.
@zakiva 👍 Can you please send the second PR and label it as fine/no so we can view the while solution?
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.
sure, #119
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 both
Seems that there is no way to uniquely identify the image from the task list. If that indeed is the case, then, this seems to be the next best solution. |
3cdbf2d
to
496438a
Compare
@epacific1 I added the image id too as we discussed, please see the updated screenshot above |
I had a look at the new screenshot. It does not make sense to display the ID as (xx). |
496438a
to
cf53509
Compare
@epacific1 OK, done. |
Checked commit zakiva@cf53509 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Fine backport (to manageiq repo) details:
|
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1483590
Related PR: #119
Adding the scanned image name to the task name: