{"action":"created","comment":{"url":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/comments/146519263","pull_request_review_id":71469534,"id":146519263,"diff_hunk":"@@ -62,16 +63,21 @@ def run(self):\n \n             base_image_with_registry.registry = self.parent_registry\n \n-        pulled_base = self.tasker.pull_image(base_image_with_registry,\n-                                             insecure=self.parent_registry_insecure)\n-        if (base_image_with_registry.namespace != 'library' and\n-                not self.tasker.image_exists(base_image_with_registry.to_str())):\n-            self.log.info(\"'%s' not found\", base_image_with_registry.to_str())\n-            base_image_with_registry.namespace = 'library'\n-            self.log.info(\"trying '%s'\", base_image_with_registry.to_str())\n-            pulled_base = self.tasker.pull_image(base_image_with_registry,\n-                                                 insecure=self.parent_registry_insecure)\n+        try:\n+            self.tasker.pull_image(base_image_with_registry,\n+                                   insecure=self.parent_registry_insecure)\n \n+        except RetryGeneratorException:\n+            if base_image_with_registry.namespace != 'library':\n+                self.log.info(\"'%s' not found\", base_image_with_registry.to_str())\n+                base_image_with_registry.namespace = 'library'\n+                self.log.info(\"trying '%s'\", base_image_with_registry.to_str())\n+                self.tasker.pull_image(base_image_with_registry,\n+                                       insecure=self.parent_registry_insecure)\n+            else:\n+                raise","path":"atomic_reactor/plugins/pre_pull_base_image.py","position":33,"original_position":33,"commit_id":"383faf0ef9d95ec7108267d05fe30ad0b38cf462","original_commit_id":"e669ee82cc14f65b1d9fe53e6a3ad1575618da89","user":{"login":"twaugh","id":6985468,"avatar_url":"https://avatars1.githubusercontent.com/u/6985468?v=4","gravatar_id":"","url":"https://api.github.com/users/twaugh","html_url":"https://github.com/twaugh","followers_url":"https://api.github.com/users/twaugh/followers","following_url":"https://api.github.com/users/twaugh/following{/other_user}","gists_url":"https://api.github.com/users/twaugh/gists{/gist_id}","starred_url":"https://api.github.com/users/twaugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twaugh/subscriptions","organizations_url":"https://api.github.com/users/twaugh/orgs","repos_url":"https://api.github.com/users/twaugh/repos","events_url":"https://api.github.com/users/twaugh/events{/privacy}","received_events_url":"https://api.github.com/users/twaugh/received_events","type":"User","site_admin":false},"body":"Could put the `raise` block first to avoid needing to indent the rest, e.g.\r\n```\r\nif ... == 'library':\r\n    # Nothing else to try\r\n    raise\r\n\r\nself.log.info(...)\r\n...\r\n```\r\n\r\nAlso, I think we want the error to look different for these two cases:\r\n- retries failed due to some sort of network issue (this is a potentially serious system issue)\r\n- the image just isn't there (this is just user error)\r\n\r\nAt the very least the exception's message should be different... even better would be a different exception. We seem to use RuntimeError for that sort of thing, but even that seems pretty generic.","created_at":"2017-10-24T10:39:00Z","updated_at":"2017-10-24T10:58:08Z","html_url":"https://github.com/projectatomic/atomic-reactor/pull/869#discussion_r146519263","pull_request_url":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/869","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/comments/146519263"},"html":{"href":"https://github.com/projectatomic/atomic-reactor/pull/869#discussion_r146519263"},"pull_request":{"href":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/869"}}},"pull_request":{"url":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/869","id":147543451,"html_url":"https://github.com/projectatomic/atomic-reactor/pull/869","diff_url":"https://github.com/projectatomic/atomic-reactor/pull/869.diff","patch_url":"https://github.com/projectatomic/atomic-reactor/pull/869.patch","issue_url":"https://api.github.com/repos/projectatomic/atomic-reactor/issues/869","number":869,"state":"open","locked":false,"title":"retry on docker pull and push","user":{"login":"rcerven","id":23337371,"avatar_url":"https://avatars0.githubusercontent.com/u/23337371?v=4","gravatar_id":"","url":"https://api.github.com/users/rcerven","html_url":"https://github.com/rcerven","followers_url":"https://api.github.com/users/rcerven/followers","following_url":"https://api.github.com/users/rcerven/following{/other_user}","gists_url":"https://api.github.com/users/rcerven/gists{/gist_id}","starred_url":"https://api.github.com/users/rcerven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcerven/subscriptions","organizations_url":"https://api.github.com/users/rcerven/orgs","repos_url":"https://api.github.com/users/rcerven/repos","events_url":"https://api.github.com/users/rcerven/events{/privacy}","received_events_url":"https://api.github.com/users/rcerven/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Robert Cerven <rcerven@redhat.com>","created_at":"2017-10-19T12:31:57Z","updated_at":"2017-10-24T10:58:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bbf3ae7d7f5124395d68867b75f85a0769121a03","assignee":null,"assignees":[],"requested_reviewers":[{"login":"lcarva","id":5272931,"avatar_url":"https://avatars1.githubusercontent.com/u/5272931?v=4","gravatar_id":"","url":"https://api.github.com/users/lcarva","html_url":"https://github.com/lcarva","followers_url":"https://api.github.com/users/lcarva/followers","following_url":"https://api.github.com/users/lcarva/following{/other_user}","gists_url":"https://api.github.com/users/lcarva/gists{/gist_id}","starred_url":"https://api.github.com/users/lcarva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lcarva/subscriptions","organizations_url":"https://api.github.com/users/lcarva/orgs","repos_url":"https://api.github.com/users/lcarva/repos","events_url":"https://api.github.com/users/lcarva/events{/privacy}","received_events_url":"https://api.github.com/users/lcarva/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/869/commits","review_comments_url":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/869/comments","review_comment_url":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/projectatomic/atomic-reactor/issues/869/comments","statuses_url":"https://api.github.com/repos/projectatomic/atomic-reactor/statuses/383faf0ef9d95ec7108267d05fe30ad0b38cf462","head":{"label":"rcerven:retry_on_docker_pull","ref":"retry_on_docker_pull","sha":"383faf0ef9d95ec7108267d05fe30ad0b38cf462","user":{"login":"rcerven","id":23337371,"avatar_url":"https://avatars0.githubusercontent.com/u/23337371?v=4","gravatar_id":"","url":"https://api.github.com/users/rcerven","html_url":"https://github.com/rcerven","followers_url":"https://api.github.com/users/rcerven/followers","following_url":"https://api.github.com/users/rcerven/following{/other_user}","gists_url":"https://api.github.com/users/rcerven/gists{/gist_id}","starred_url":"https://api.github.com/users/rcerven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcerven/subscriptions","organizations_url":"https://api.github.com/users/rcerven/orgs","repos_url":"https://api.github.com/users/rcerven/repos","events_url":"https://api.github.com/users/rcerven/events{/privacy}","received_events_url":"https://api.github.com/users/rcerven/received_events","type":"User","site_admin":false},"repo":{"id":74351578,"name":"atomic-reactor","full_name":"rcerven/atomic-reactor","owner":{"login":"rcerven","id":23337371,"avatar_url":"https://avatars0.githubusercontent.com/u/23337371?v=4","gravatar_id":"","url":"https://api.github.com/users/rcerven","html_url":"https://github.com/rcerven","followers_url":"https://api.github.com/users/rcerven/followers","following_url":"https://api.github.com/users/rcerven/following{/other_user}","gists_url":"https://api.github.com/users/rcerven/gists{/gist_id}","starred_url":"https://api.github.com/users/rcerven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcerven/subscriptions","organizations_url":"https://api.github.com/users/rcerven/orgs","repos_url":"https://api.github.com/users/rcerven/repos","events_url":"https://api.github.com/users/rcerven/events{/privacy}","received_events_url":"https://api.github.com/users/rcerven/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rcerven/atomic-reactor","description":"Simple python library for building docker images.","fork":true,"url":"https://api.github.com/repos/rcerven/atomic-reactor","forks_url":"https://api.github.com/repos/rcerven/atomic-reactor/forks","keys_url":"https://api.github.com/repos/rcerven/atomic-reactor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rcerven/atomic-reactor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rcerven/atomic-reactor/teams","hooks_url":"https://api.github.com/repos/rcerven/atomic-reactor/hooks","issue_events_url":"https://api.github.com/repos/rcerven/atomic-reactor/issues/events{/number}","events_url":"https://api.github.com/repos/rcerven/atomic-reactor/events","assignees_url":"https://api.github.com/repos/rcerven/atomic-reactor/assignees{/user}","branches_url":"https://api.github.com/repos/rcerven/atomic-reactor/branches{/branch}","tags_url":"https://api.github.com/repos/rcerven/atomic-reactor/tags","blobs_url":"https://api.github.com/repos/rcerven/atomic-reactor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rcerven/atomic-reactor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rcerven/atomic-reactor/git/refs{/sha}","trees_url":"https://api.github.com/repos/rcerven/atomic-reactor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rcerven/atomic-reactor/statuses/{sha}","languages_url":"https://api.github.com/repos/rcerven/atomic-reactor/languages","stargazers_url":"https://api.github.com/repos/rcerven/atomic-reactor/stargazers","contributors_url":"https://api.github.com/repos/rcerven/atomic-reactor/contributors","subscribers_url":"https://api.github.com/repos/rcerven/atomic-reactor/subscribers","subscription_url":"https://api.github.com/repos/rcerven/atomic-reactor/subscription","commits_url":"https://api.github.com/repos/rcerven/atomic-reactor/commits{/sha}","git_commits_url":"https://api.github.com/repos/rcerven/atomic-reactor/git/commits{/sha}","comments_url":"https://api.github.com/repos/rcerven/atomic-reactor/comments{/number}","issue_comment_url":"https://api.github.com/repos/rcerven/atomic-reactor/issues/comments{/number}","contents_url":"https://api.github.com/repos/rcerven/atomic-reactor/contents/{+path}","compare_url":"https://api.github.com/repos/rcerven/atomic-reactor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rcerven/atomic-reactor/merges","archive_url":"https://api.github.com/repos/rcerven/atomic-reactor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rcerven/atomic-reactor/downloads","issues_url":"https://api.github.com/repos/rcerven/atomic-reactor/issues{/number}","pulls_url":"https://api.github.com/repos/rcerven/atomic-reactor/pulls{/number}","milestones_url":"https://api.github.com/repos/rcerven/atomic-reactor/milestones{/number}","notifications_url":"https://api.github.com/repos/rcerven/atomic-reactor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rcerven/atomic-reactor/labels{/name}","releases_url":"https://api.github.com/repos/rcerven/atomic-reactor/releases{/id}","deployments_url":"https://api.github.com/repos/rcerven/atomic-reactor/deployments","created_at":"2016-11-21T10:15:27Z","updated_at":"2016-11-21T10:15:28Z","pushed_at":"2017-10-24T10:56:52Z","git_url":"git://github.com/rcerven/atomic-reactor.git","ssh_url":"git@github.com:rcerven/atomic-reactor.git","clone_url":"https://github.com/rcerven/atomic-reactor.git","svn_url":"https://github.com/rcerven/atomic-reactor","homepage":"","size":2655,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"projectatomic:master","ref":"master","sha":"f3a49aa00aaee767a70684e2cc7a3434e0e88ee9","user":{"login":"projectatomic","id":6852258,"avatar_url":"https://avatars1.githubusercontent.com/u/6852258?v=4","gravatar_id":"","url":"https://api.github.com/users/projectatomic","html_url":"https://github.com/projectatomic","followers_url":"https://api.github.com/users/projectatomic/followers","following_url":"https://api.github.com/users/projectatomic/following{/other_user}","gists_url":"https://api.github.com/users/projectatomic/gists{/gist_id}","starred_url":"https://api.github.com/users/projectatomic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectatomic/subscriptions","organizations_url":"https://api.github.com/users/projectatomic/orgs","repos_url":"https://api.github.com/users/projectatomic/repos","events_url":"https://api.github.com/users/projectatomic/events{/privacy}","received_events_url":"https://api.github.com/users/projectatomic/received_events","type":"Organization","site_admin":false},"repo":{"id":25527782,"name":"atomic-reactor","full_name":"projectatomic/atomic-reactor","owner":{"login":"projectatomic","id":6852258,"avatar_url":"https://avatars1.githubusercontent.com/u/6852258?v=4","gravatar_id":"","url":"https://api.github.com/users/projectatomic","html_url":"https://github.com/projectatomic","followers_url":"https://api.github.com/users/projectatomic/followers","following_url":"https://api.github.com/users/projectatomic/following{/other_user}","gists_url":"https://api.github.com/users/projectatomic/gists{/gist_id}","starred_url":"https://api.github.com/users/projectatomic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectatomic/subscriptions","organizations_url":"https://api.github.com/users/projectatomic/orgs","repos_url":"https://api.github.com/users/projectatomic/repos","events_url":"https://api.github.com/users/projectatomic/events{/privacy}","received_events_url":"https://api.github.com/users/projectatomic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectatomic/atomic-reactor","description":"Simple python library for building docker images.","fork":false,"url":"https://api.github.com/repos/projectatomic/atomic-reactor","forks_url":"https://api.github.com/repos/projectatomic/atomic-reactor/forks","keys_url":"https://api.github.com/repos/projectatomic/atomic-reactor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectatomic/atomic-reactor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectatomic/atomic-reactor/teams","hooks_url":"https://api.github.com/repos/projectatomic/atomic-reactor/hooks","issue_events_url":"https://api.github.com/repos/projectatomic/atomic-reactor/issues/events{/number}","events_url":"https://api.github.com/repos/projectatomic/atomic-reactor/events","assignees_url":"https://api.github.com/repos/projectatomic/atomic-reactor/assignees{/user}","branches_url":"https://api.github.com/repos/projectatomic/atomic-reactor/branches{/branch}","tags_url":"https://api.github.com/repos/projectatomic/atomic-reactor/tags","blobs_url":"https://api.github.com/repos/projectatomic/atomic-reactor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectatomic/atomic-reactor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectatomic/atomic-reactor/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectatomic/atomic-reactor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectatomic/atomic-reactor/statuses/{sha}","languages_url":"https://api.github.com/repos/projectatomic/atomic-reactor/languages","stargazers_url":"https://api.github.com/repos/projectatomic/atomic-reactor/stargazers","contributors_url":"https://api.github.com/repos/projectatomic/atomic-reactor/contributors","subscribers_url":"https://api.github.com/repos/projectatomic/atomic-reactor/subscribers","subscription_url":"https://api.github.com/repos/projectatomic/atomic-reactor/subscription","commits_url":"https://api.github.com/repos/projectatomic/atomic-reactor/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectatomic/atomic-reactor/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectatomic/atomic-reactor/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectatomic/atomic-reactor/issues/comments{/number}","contents_url":"https://api.github.com/repos/projectatomic/atomic-reactor/contents/{+path}","compare_url":"https://api.github.com/repos/projectatomic/atomic-reactor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectatomic/atomic-reactor/merges","archive_url":"https://api.github.com/repos/projectatomic/atomic-reactor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectatomic/atomic-reactor/downloads","issues_url":"https://api.github.com/repos/projectatomic/atomic-reactor/issues{/number}","pulls_url":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls{/number}","milestones_url":"https://api.github.com/repos/projectatomic/atomic-reactor/milestones{/number}","notifications_url":"https://api.github.com/repos/projectatomic/atomic-reactor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectatomic/atomic-reactor/labels{/name}","releases_url":"https://api.github.com/repos/projectatomic/atomic-reactor/releases{/id}","deployments_url":"https://api.github.com/repos/projectatomic/atomic-reactor/deployments","created_at":"2014-10-21T14:45:11Z","updated_at":"2017-10-18T07:00:54Z","pushed_at":"2017-10-24T10:56:53Z","git_url":"git://github.com/projectatomic/atomic-reactor.git","ssh_url":"git@github.com:projectatomic/atomic-reactor.git","clone_url":"https://github.com/projectatomic/atomic-reactor.git","svn_url":"https://github.com/projectatomic/atomic-reactor","homepage":"","size":2722,"stargazers_count":92,"watchers_count":92,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"archived":false,"open_issues_count":56,"forks":37,"open_issues":56,"watchers":92,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/869"},"html":{"href":"https://github.com/projectatomic/atomic-reactor/pull/869"},"issue":{"href":"https://api.github.com/repos/projectatomic/atomic-reactor/issues/869"},"comments":{"href":"https://api.github.com/repos/projectatomic/atomic-reactor/issues/869/comments"},"review_comments":{"href":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/869/comments"},"review_comment":{"href":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/projectatomic/atomic-reactor/pulls/869/commits"},"statuses":{"href":"https://api.github.com/repos/projectatomic/atomic-reactor/statuses/383faf0ef9d95ec7108267d05fe30ad0b38cf462"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"twaugh"}}