{"action":"created","issue":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/11806","repository_url":"https://api.github.com/repos/ManageIQ/manageiq","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/11806/labels{/name}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/11806/comments","events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/11806/events","html_url":"https://github.com/ManageIQ/manageiq/pull/11806","id":182084432,"number":11806,"title":"Rewrite of auto-tagging, fixing multiple bugs","user":{"login":"cben","id":273688,"avatar_url":"https://avatars.githubusercontent.com/u/273688?v=3","gravatar_id":"","url":"https://api.github.com/users/cben","html_url":"https://github.com/cben","followers_url":"https://api.github.com/users/cben/followers","following_url":"https://api.github.com/users/cben/following{/other_user}","gists_url":"https://api.github.com/users/cben/gists{/gist_id}","starred_url":"https://api.github.com/users/cben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cben/subscriptions","organizations_url":"https://api.github.com/users/cben/orgs","repos_url":"https://api.github.com/users/cben/repos","events_url":"https://api.github.com/users/cben/events{/privacy}","received_events_url":"https://api.github.com/users/cben/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/darga/yes","name":"darga/yes","color":"555555"},{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/euwe/yes","name":"euwe/yes","color":"000000"},{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/providers/containers","name":"providers/containers","color":"5319e7"}],"state":"open","locked":false,"assignee":{"login":"simon3z","id":130393,"avatar_url":"https://avatars.githubusercontent.com/u/130393?v=3","gravatar_id":"","url":"https://api.github.com/users/simon3z","html_url":"https://github.com/simon3z","followers_url":"https://api.github.com/users/simon3z/followers","following_url":"https://api.github.com/users/simon3z/following{/other_user}","gists_url":"https://api.github.com/users/simon3z/gists{/gist_id}","starred_url":"https://api.github.com/users/simon3z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simon3z/subscriptions","organizations_url":"https://api.github.com/users/simon3z/orgs","repos_url":"https://api.github.com/users/simon3z/repos","events_url":"https://api.github.com/users/simon3z/events{/privacy}","received_events_url":"https://api.github.com/users/simon3z/received_events","type":"User","site_admin":false},"assignees":[{"login":"simon3z","id":130393,"avatar_url":"https://avatars.githubusercontent.com/u/130393?v=3","gravatar_id":"","url":"https://api.github.com/users/simon3z","html_url":"https://github.com/simon3z","followers_url":"https://api.github.com/users/simon3z/followers","following_url":"https://api.github.com/users/simon3z/following{/other_user}","gists_url":"https://api.github.com/users/simon3z/gists{/gist_id}","starred_url":"https://api.github.com/users/simon3z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simon3z/subscriptions","organizations_url":"https://api.github.com/users/simon3z/orgs","repos_url":"https://api.github.com/users/simon3z/repos","events_url":"https://api.github.com/users/simon3z/events{/privacy}","received_events_url":"https://api.github.com/users/simon3z/received_events","type":"User","site_admin":false}],"milestone":null,"comments":12,"created_at":"2016-10-10T18:39:42Z","updated_at":"2016-10-27T07:04:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11806","html_url":"https://github.com/ManageIQ/manageiq/pull/11806","diff_url":"https://github.com/ManageIQ/manageiq/pull/11806.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/11806.patch"},"body":"A major rewrite of auto-tagging from kubernetes labels.\r\nSorry for big PR, but old code was broken in too many ways.\r\n\r\n## Functionality changes:\r\n\r\n- Find existing tag if already created.  This should fix refresh crashes:\r\n\r\n  https://bugzilla.redhat.com/show_bug.cgi?id=1382347\r\n  (cases were several values with different case/punctuation are mapped to the same tag)\r\n  https://bugzilla.redhat.com/show_bug.cgi?id=1382361\r\n  (when concurrent refresh already created the same classification but it is not in our cache)\r\n\r\n  - Added regression tests for all these failure modes.\r\n    Added some auto-tagging testing to the full refresh integration tests.\r\n\r\n  - This will map `name=value` and `name=VALUE` labels to same tag,\r\n    which does not reflect Kubernetes label case-sensitive semantics, but is OK in practice.\r\n    Alternative would be creating tags with ugly `name` containing e.g. SHA1 of the label value.\r\n\r\n- Catch & log exceptions so if any auto-tagging bugs remain, they won't break refresh.\r\n\r\n- Do not insert mappings while mapping.\r\n  Previously given any-value mapping for `name`, when encountering new `name=value` label,\r\n  we'd insert both new Tag + Classification and a new specific-value mapping for (`name`, `value`).\r\n\r\n  This reduces cache issues, plus will be less confusing in UI #11591.\r\n\r\n  - We still insert Tag + Classification.  Attempted making this race-condition-free.  Locking the parent Classification row (only when created new entry for a new label value).  Not sure it's bulletproof.\r\n\r\n- Caching is now bounded to one refresh.\r\n  Will allow UI (#11591) editing the table to take effect on next refresh.\r\n\r\n- Reverted [previous decision](https://github.com/ManageIQ/manageiq/issues/9713#issuecomment-233929144) on empty-value handling — we decided to not create special \"\\<Empty>\" tags for them.\r\n\r\n## Refactoring\r\n\r\nRewrote how mapping table is cached (no more permanent global cache), and how it's called from refresh.\r\n\r\nContainerLabelTagMapping interface is now a bit weird:\r\n1. obtain cache\r\n2. given cache, map labels to hashes - called in refresh_parser\r\n3. given hashes, create and [un]assign tags - called in save_tags_inventory\r\n\r\nThe labels it takes are now in {:name, :value} format rather than CustomAttribute instances.\r\n\r\nParsing now returns independent :labels and :tags, got rid of :labels_and_tags.\r\n\r\n@miq-bot add-label providers/containers, bug, darga/yes, euwe/yes\r\n\r\nThanks @moolitayer for design help & pair programming."},"comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments/256563129","html_url":"https://github.com/ManageIQ/manageiq/pull/11806#issuecomment-256563129","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/11806","id":256563129,"user":{"login":"cben","id":273688,"avatar_url":"https://avatars.githubusercontent.com/u/273688?v=3","gravatar_id":"","url":"https://api.github.com/users/cben","html_url":"https://github.com/cben","followers_url":"https://api.github.com/users/cben/followers","following_url":"https://api.github.com/users/cben/following{/other_user}","gists_url":"https://api.github.com/users/cben/gists{/gist_id}","starred_url":"https://api.github.com/users/cben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cben/subscriptions","organizations_url":"https://api.github.com/users/cben/orgs","repos_url":"https://api.github.com/users/cben/repos","events_url":"https://api.github.com/users/cben/events{/privacy}","received_events_url":"https://api.github.com/users/cben/received_events","type":"User","site_admin":false},"created_at":"2016-10-27T07:04:20Z","updated_at":"2016-10-27T07:04:20Z","body":"Doing more manual testing but I believe this is done & ready.\r\n@moolitayer can you also review the last commit?\r\n"}}
{"actor":{"display_login":"cben"}}