Skip to content
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

Merged
merged 1 commit into from
Sep 27, 2017

Conversation

zakiva
Copy link
Contributor

@zakiva zakiva commented Aug 29, 2017

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1483590

Related PR: #119

Adding the scanned image name to the task name:

imageonlyname

@zakiva
Copy link
Contributor Author

zakiva commented Aug 29, 2017

@simon3z @moolitayer Please review

@simon3z
Copy link
Contributor

simon3z commented Aug 29, 2017

@zakiva please check if this is OK for Einat as well, she needs this for her tests.

@moolitayer
Copy link

@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)
Copy link
Contributor Author

@zakiva zakiva Aug 30, 2017

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

Copy link

@moolitayer moolitayer Aug 30, 2017

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moolitayer thanks, done

@moolitayer
Copy link

@zakiva please check if this is OK for Einat as well, she needs this for her tests.

cc @epacific1, changes are coming ❄️

@zakiva
Copy link
Contributor Author

zakiva commented Aug 30, 2017

@zakiva can we avoid reloading the image by passing it's name in check_policy_prevent?

@moolitayer yes, I think it's possible. Please see a small related question in line.

@zakiva
Copy link
Contributor Author

zakiva commented Sep 12, 2017

@moolitayer PTAL

Copy link

@moolitayer moolitayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍
@simon3z @cben please review this change

Copy link
Contributor

@cben cben left a 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)
Copy link
Contributor

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.

Copy link
Contributor

@cben cben Sep 12, 2017

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...

Copy link
Contributor

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.).

Copy link
Contributor

@cben cben Sep 14, 2017

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.]

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)

Copy link
Contributor Author

@zakiva zakiva Sep 26, 2017

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.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, #119

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM both

@epacific1
Copy link

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.

@zakiva
Copy link
Contributor Author

zakiva commented Sep 17, 2017

@epacific1 I added the image id too as we discussed, please see the updated screenshot above

@epacific1
Copy link

I had a look at the new screenshot. It does not make sense to display the ID as (xx).
Lets revert back to just the image name.

@zakiva
Copy link
Contributor Author

zakiva commented Sep 18, 2017

I had a look at the new screenshot. It does not make sense to display the ID as (xx).
Lets revert back to just the image name.

@epacific1 OK, done.

@miq-bot
Copy link
Member

miq-bot commented Sep 18, 2017

Checked commit zakiva@cf53509 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks fine. 👍

@simon3z simon3z merged commit 7c48e38 into ManageIQ:master Sep 27, 2017
@agrare agrare added this to the Sprint 70 Ending Oct 2, 2017 milestone Oct 2, 2017
@simaishi
Copy link

Fine backport (to manageiq repo) details:

$ git log -1
commit 0f30b0a104d6473bffc9ac860aed71a43a01b2d5
Author: Federico Simoncelli <[email protected]>
Date:   Wed Sep 27 23:39:09 2017 +0200

    Merge pull request #105 from zakiva/add_image_name
    
    Image scanning: Add image name to task name
    (cherry picked from commit 7c48e385e8d10f20adaf164e59fe3876fbd7b318)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1496943

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants