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

handling docker-pullable image ids #12711

Merged

Conversation

enoodle
Copy link

@enoodle enoodle commented Nov 17, 2016

Recently Kubernetes / Docker started having a different prefix to the docker imageID: docker-pullable. This PR handles the changes needed to handle this change to save the image digest, name and docker_id and use them in a similar way to what was intended before.

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

@enoodle
Copy link
Author

enoodle commented Nov 17, 2016

cc @bazulay @simon3z

@simon3z
Copy link
Contributor

simon3z commented Nov 17, 2016

@zeari can you review? (Probably you already reviewed part/all of it in the other PR but I want to make sure)

@simon3z
Copy link
Contributor

simon3z commented Nov 17, 2016

cc @moolitayer (review if you have time)

@simon3z
Copy link
Contributor

simon3z commented Nov 17, 2016

@miq-bot add_label providers/containers, bug

(?:(?:
(?<host>([^\.:/]+\.)+[^\.:/]+)|
(?:(?<host2>[^:/]+)(?::(?<port>\d+)))|
(?<localhost>localhost)
)/)?
(?<name>(?:[^:/@]+/)*[^/:@]+)
(?:(?::(?<tag>.+))|(?:\@(?<digest>.+)))?
(?::(?<tag>[^:/@]+))?
(?:\@(?<digest>.+))?

Choose a reason for hiding this comment

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

Can we have both a tag and a digest? (asking about the change from | to both parts being optional)

Copy link
Author

Choose a reason for hiding this comment

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

Yes, Now we can have them both, but before is was one or the other (The tag would have included the digest..)

:digest => parts[:digest],
:name => image_parts[:name],
:tag => image_parts[:tag],
:digest => image_parts[:digest] || image_ref_parts[:digest],

Choose a reason for hiding this comment

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

can you give an example of an image ref with a digest?

Copy link
Author

Choose a reason for hiding this comment

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

docker-pullable://registry.access.redhat.com/openshift3/metrics-deployer@sha256:45f2f81608edcdf53f8f94b4893fc33c824a5ca79d467191e5db1a267f46bb3a

It seems that the new docker added the registry and name to the imageID field too after the docker-pullable:// prefix.

@enoodle enoodle force-pushed the docker_pullable_container_images_ids branch 4 times, most recently from 9e49471 to d9a1611 Compare November 20, 2016 12:55
@enoodle enoodle closed this Nov 20, 2016
@enoodle enoodle reopened this Nov 20, 2016
@enoodle enoodle force-pushed the docker_pullable_container_images_ids branch from d9a1611 to ef2ca66 Compare November 20, 2016 17:54
@simon3z
Copy link
Contributor

simon3z commented Nov 21, 2016

@enoodle can you try to find reviews and LGTM for this? Thanks.

:image => {:name => "name1", :tag => "tagos", :digest => "sha256:123abcdef",
:image_ref => example_ref},
:registry => {:name => "reg.example.com", :host => "reg.example.com", :port => "1234"}},

Choose a reason for hiding this comment

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

Can you add a test for the new definitions?

Copy link
Author

@enoodle enoodle Dec 1, 2016

Choose a reason for hiding this comment

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

@moolitayer I added this test below:

@enoodle enoodle force-pushed the docker_pullable_container_images_ids branch from ef2ca66 to d8cd039 Compare November 21, 2016 12:31
@enoodle
Copy link
Author

enoodle commented Nov 21, 2016

@moolitayer I added more tests

@moolitayer
Copy link

Thanks @enoodle
LGTM 👍

@simon3z
Copy link
Contributor

simon3z commented Nov 21, 2016

LGTM 👍
@chessbyte ready for merge

@miq-bot assign chessbyte

@miq-bot miq-bot assigned chessbyte and unassigned simon3z Nov 21, 2016
@simon3z
Copy link
Contributor

simon3z commented Nov 21, 2016

@enoodle we need this to be backported right?

Is this all the ManageIQ side needed to address the relevant bug?

@enoodle
Copy link
Author

enoodle commented Nov 21, 2016

@simon3z Yes, backport to euwe
No, more is needed to handle the difference in the ID's between docker and the RepoDigests that we now get from kubernetes.

@simon3z
Copy link
Contributor

simon3z commented Nov 21, 2016

No, more is needed to handle the difference in the ID's between docker and the RepoDigests that we now get from kubernetes.

@miq-bot assign enoodle

@enoodle please add that as well here so that we don't need any other BZ to merge the extra PRs.

@miq-bot miq-bot assigned enoodle and unassigned chessbyte Nov 21, 2016
end

"cannot analyze image %s with id %s: detected id was %s" % [
options[:image_full_name], options[:docker_image_id][0..11], actual[0..11]]
Copy link
Contributor

Choose a reason for hiding this comment

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

@enoodle don't you have to update this being more specific now? (Maybe the check that failed was about the RepoDigests) No need for anything fancy... I just feel that this message now is misleading.

Copy link
Author

@enoodle enoodle Nov 23, 2016

Choose a reason for hiding this comment

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

@simon3z We wouldn't know which one "should" have not failed as all the checks have already failed. I could also add the detected RepoDigests
Some thing like this:

    msg = "cannot analyze image %s with id %s: detected ids were %s" % [
      options[:image_full_name], options[:docker_image_id][0..11], actual[0..11]]
    metadata.RepoDigests.each do |digest|
      msg << digest.split('@').last[0..11] + ", "
    end
    return msg

I am splitting on '@' because RepoDigests include the image-repository and name but this will be less interesting in this message in my opinion.

Copy link
Author

Choose a reason for hiding this comment

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

@simon3z I made this change, PTAL at the code.

@enoodle enoodle force-pushed the docker_pullable_container_images_ids branch 2 times, most recently from 958471d to 6906640 Compare November 24, 2016 11:05
@enoodle enoodle force-pushed the docker_pullable_container_images_ids branch from 6906640 to 0ab53d9 Compare November 24, 2016 11:20
@miq-bot
Copy link
Member

miq-bot commented Nov 24, 2016

<github_pr_commenter_batch />Some comments on commits enoodle/manageiq@eebf813~...0ab53d9

spec/models/manageiq/providers/kubernetes/container_manager/scanning/job_spec.rb

  • ⚠️ - 123 - Detected allow_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 243 - Detected allow_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 244 - Detected allow_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.

@miq-bot
Copy link
Member

miq-bot commented Nov 24, 2016

Checked commits enoodle/manageiq@eebf813~...0ab53d9 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
6 files checked, 3 offenses detected

app/models/manageiq/providers/kubernetes/container_manager/scanning/job.rb

  • ❕ - Line 116, Col 3 - Metrics/AbcSize - Assignment Branch Condition size for verify_scanned_image_id is too high. [23.39/20]

spec/models/manageiq/providers/kubernetes/container_manager/scanning/job_spec.rb

@enoodle
Copy link
Author

enoodle commented Dec 1, 2016

@moolitayer @zeari PTAL

@zeari
Copy link

zeari commented Dec 1, 2016

LGTM

@enoodle
Copy link
Author

enoodle commented Dec 1, 2016

ping @simon3z @chessbyte

@simon3z
Copy link
Contributor

simon3z commented Dec 1, 2016

Ready for merge 👍
cc @chessbyte

@miq-bot assign chessbyte

@miq-bot miq-bot assigned chessbyte and unassigned enoodle Dec 1, 2016
@simon3z
Copy link
Contributor

simon3z commented Dec 1, 2016

cc @roliveri

@chessbyte chessbyte assigned roliveri and unassigned chessbyte Dec 1, 2016
@roliveri roliveri merged commit 4a52be9 into ManageIQ:master Dec 1, 2016
@chessbyte chessbyte added this to the Sprint 50 Ending Dec 5, 2016 milestone Dec 2, 2016
@chessbyte
Copy link
Member

@chessbyte
Copy link
Member

Euwe Backport details:

$ git log -1
commit 8c861a6fd622c29fbeca3cfd5bdfddd4e8fb9abd
Author: Richard Oliveri <oliveri.richard.github@gmail.com>
Date:   Thu Dec 1 12:44:58 2016 -0500

    Merge pull request #12711 from enoodle/docker_pullable_container_images_ids
    
    handling docker-pullable image ids
    (cherry picked from commit 4a52be99ceb25b66099b6dfce9200963ec978d30)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1348610
    https://bugzilla.redhat.com/show_bug.cgi?id=1400615

@chessbyte
Copy link
Member

Backported to Darga via #13142

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.

None yet

9 participants