{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/test-infra/pulls/comments/167373812","pull_request_review_id":95595430,"id":167373812,"diff_hunk":"@@ -30,8 +31,49 @@ def check(*cmd):\n     print >>sys.stderr, 'Run:', cmd\n     subprocess.check_call(cmd)\n \n+def check_output(*cmd):\n+    \"\"\"Log and run the command, raising on errors, return output\"\"\"\n+    print >>sys.stderr, 'Run:', cmd\n+    return subprocess.check_output(cmd)\n+\n+def check_build_exists(gcs, suffix):\n+    \"\"\" check if a k8s/federation build with same version\n+        already exists in remote path\n+    \"\"\"\n+    if not os.path.exists('hack/print-workspace-status.sh'):\n+        print >>sys.stderr, 'hack/print-workspace-status.sh not found, continue'\n+        return False\n+\n+    version = ''\n+    try:\n+        match = re.search(\n+            r'gitVersion ([^\\n]+)',\n+            check_output('hack/print-workspace-status.sh')\n+        )\n+        if match:\n+            version = match.group(1)\n+    except subprocess.CalledProcessError as exc:\n+        # fallback with doing a real build\n+        print >>sys.stderr, 'Failed to get k8s version, continue: %s' % exc\n+        return False\n+\n+    if version:\n+        if not gcs:\n+            gcs = 'gs://kubernetes-release-dev'\n+        mode = 'ci'\n+        if suffix:\n+            mode = os.path.join(mode, suffix)\n+        gcs = os.path.join(gcs, mode, version)\n+        try:\n+            check('gsutil', 'ls', gcs)","path":"scenarios/kubernetes_build.py","position":46,"original_position":46,"commit_id":"724648a9114eb97b1dd0e3217c107b55934940bc","original_commit_id":"724648a9114eb97b1dd0e3217c107b55934940bc","user":{"login":"ixdy","id":8061296,"avatar_url":"https://avatars3.githubusercontent.com/u/8061296?v=4","gravatar_id":"","url":"https://api.github.com/users/ixdy","html_url":"https://github.com/ixdy","followers_url":"https://api.github.com/users/ixdy/followers","following_url":"https://api.github.com/users/ixdy/following{/other_user}","gists_url":"https://api.github.com/users/ixdy/gists{/gist_id}","starred_url":"https://api.github.com/users/ixdy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ixdy/subscriptions","organizations_url":"https://api.github.com/users/ixdy/orgs","repos_url":"https://api.github.com/users/ixdy/repos","events_url":"https://api.github.com/users/ixdy/events{/privacy}","received_events_url":"https://api.github.com/users/ixdy/received_events","type":"User","site_admin":false},"body":"something like https://stackoverflow.com/a/11269627, probably?","created_at":"2018-02-09T23:42:09Z","updated_at":"2018-02-09T23:42:09Z","html_url":"https://github.com/kubernetes/test-infra/pull/6749#discussion_r167373812","pull_request_url":"https://api.github.com/repos/kubernetes/test-infra/pulls/6749","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/comments/167373812"},"html":{"href":"https://github.com/kubernetes/test-infra/pull/6749#discussion_r167373812"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/6749"}},"in_reply_to_id":167372415},"pull_request":{"url":"https://api.github.com/repos/kubernetes/test-infra/pulls/6749","id":168149912,"html_url":"https://github.com/kubernetes/test-infra/pull/6749","diff_url":"https://github.com/kubernetes/test-infra/pull/6749.diff","patch_url":"https://github.com/kubernetes/test-infra/pull/6749.patch","issue_url":"https://api.github.com/repos/kubernetes/test-infra/issues/6749","number":6749,"state":"open","locked":false,"title":"check build exists before make actual build","user":{"login":"krzyzacy","id":1108148,"avatar_url":"https://avatars3.githubusercontent.com/u/1108148?v=4","gravatar_id":"","url":"https://api.github.com/users/krzyzacy","html_url":"https://github.com/krzyzacy","followers_url":"https://api.github.com/users/krzyzacy/followers","following_url":"https://api.github.com/users/krzyzacy/following{/other_user}","gists_url":"https://api.github.com/users/krzyzacy/gists{/gist_id}","starred_url":"https://api.github.com/users/krzyzacy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krzyzacy/subscriptions","organizations_url":"https://api.github.com/users/krzyzacy/orgs","repos_url":"https://api.github.com/users/krzyzacy/repos","events_url":"https://api.github.com/users/krzyzacy/events{/privacy}","received_events_url":"https://api.github.com/users/krzyzacy/received_events","type":"User","site_admin":false},"body":"how about this?\r\ntested locally and seems to work\r\n\r\n/assign @ixdy @BenTheElder ","created_at":"2018-02-09T04:13:30Z","updated_at":"2018-02-09T23:42:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3521ab46b9859b46db3e0f87a14ee9c2caed2bf","assignee":{"login":"BenTheElder","id":917931,"avatar_url":"https://avatars2.githubusercontent.com/u/917931?v=4","gravatar_id":"","url":"https://api.github.com/users/BenTheElder","html_url":"https://github.com/BenTheElder","followers_url":"https://api.github.com/users/BenTheElder/followers","following_url":"https://api.github.com/users/BenTheElder/following{/other_user}","gists_url":"https://api.github.com/users/BenTheElder/gists{/gist_id}","starred_url":"https://api.github.com/users/BenTheElder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenTheElder/subscriptions","organizations_url":"https://api.github.com/users/BenTheElder/orgs","repos_url":"https://api.github.com/users/BenTheElder/repos","events_url":"https://api.github.com/users/BenTheElder/events{/privacy}","received_events_url":"https://api.github.com/users/BenTheElder/received_events","type":"User","site_admin":false},"assignees":[{"login":"BenTheElder","id":917931,"avatar_url":"https://avatars2.githubusercontent.com/u/917931?v=4","gravatar_id":"","url":"https://api.github.com/users/BenTheElder","html_url":"https://github.com/BenTheElder","followers_url":"https://api.github.com/users/BenTheElder/followers","following_url":"https://api.github.com/users/BenTheElder/following{/other_user}","gists_url":"https://api.github.com/users/BenTheElder/gists{/gist_id}","starred_url":"https://api.github.com/users/BenTheElder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenTheElder/subscriptions","organizations_url":"https://api.github.com/users/BenTheElder/orgs","repos_url":"https://api.github.com/users/BenTheElder/repos","events_url":"https://api.github.com/users/BenTheElder/events{/privacy}","received_events_url":"https://api.github.com/users/BenTheElder/received_events","type":"User","site_admin":false},{"login":"ixdy","id":8061296,"avatar_url":"https://avatars3.githubusercontent.com/u/8061296?v=4","gravatar_id":"","url":"https://api.github.com/users/ixdy","html_url":"https://github.com/ixdy","followers_url":"https://api.github.com/users/ixdy/followers","following_url":"https://api.github.com/users/ixdy/following{/other_user}","gists_url":"https://api.github.com/users/ixdy/gists{/gist_id}","starred_url":"https://api.github.com/users/ixdy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ixdy/subscriptions","organizations_url":"https://api.github.com/users/ixdy/orgs","repos_url":"https://api.github.com/users/ixdy/repos","events_url":"https://api.github.com/users/ixdy/events{/privacy}","received_events_url":"https://api.github.com/users/ixdy/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":705940018,"url":"https://api.github.com/repos/kubernetes/test-infra/labels/approved","name":"approved","color":"0ffa16","default":false},{"id":484580953,"url":"https://api.github.com/repos/kubernetes/test-infra/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":671126262,"url":"https://api.github.com/repos/kubernetes/test-infra/labels/size/M","name":"size/M","color":"eebb00","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/test-infra/pulls/6749/commits","review_comments_url":"https://api.github.com/repos/kubernetes/test-infra/pulls/6749/comments","review_comment_url":"https://api.github.com/repos/kubernetes/test-infra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/test-infra/issues/6749/comments","statuses_url":"https://api.github.com/repos/kubernetes/test-infra/statuses/724648a9114eb97b1dd0e3217c107b55934940bc","head":{"label":"krzyzacy:check_build","ref":"check_build","sha":"724648a9114eb97b1dd0e3217c107b55934940bc","user":{"login":"krzyzacy","id":1108148,"avatar_url":"https://avatars3.githubusercontent.com/u/1108148?v=4","gravatar_id":"","url":"https://api.github.com/users/krzyzacy","html_url":"https://github.com/krzyzacy","followers_url":"https://api.github.com/users/krzyzacy/followers","following_url":"https://api.github.com/users/krzyzacy/following{/other_user}","gists_url":"https://api.github.com/users/krzyzacy/gists{/gist_id}","starred_url":"https://api.github.com/users/krzyzacy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krzyzacy/subscriptions","organizations_url":"https://api.github.com/users/krzyzacy/orgs","repos_url":"https://api.github.com/users/krzyzacy/repos","events_url":"https://api.github.com/users/krzyzacy/events{/privacy}","received_events_url":"https://api.github.com/users/krzyzacy/received_events","type":"User","site_admin":false},"repo":{"id":65492161,"name":"test-infra","full_name":"krzyzacy/test-infra","owner":{"login":"krzyzacy","id":1108148,"avatar_url":"https://avatars3.githubusercontent.com/u/1108148?v=4","gravatar_id":"","url":"https://api.github.com/users/krzyzacy","html_url":"https://github.com/krzyzacy","followers_url":"https://api.github.com/users/krzyzacy/followers","following_url":"https://api.github.com/users/krzyzacy/following{/other_user}","gists_url":"https://api.github.com/users/krzyzacy/gists{/gist_id}","starred_url":"https://api.github.com/users/krzyzacy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krzyzacy/subscriptions","organizations_url":"https://api.github.com/users/krzyzacy/orgs","repos_url":"https://api.github.com/users/krzyzacy/repos","events_url":"https://api.github.com/users/krzyzacy/events{/privacy}","received_events_url":"https://api.github.com/users/krzyzacy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/krzyzacy/test-infra","description":"Test infrastructure for the Kubernetes project.","fork":true,"url":"https://api.github.com/repos/krzyzacy/test-infra","forks_url":"https://api.github.com/repos/krzyzacy/test-infra/forks","keys_url":"https://api.github.com/repos/krzyzacy/test-infra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/krzyzacy/test-infra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/krzyzacy/test-infra/teams","hooks_url":"https://api.github.com/repos/krzyzacy/test-infra/hooks","issue_events_url":"https://api.github.com/repos/krzyzacy/test-infra/issues/events{/number}","events_url":"https://api.github.com/repos/krzyzacy/test-infra/events","assignees_url":"https://api.github.com/repos/krzyzacy/test-infra/assignees{/user}","branches_url":"https://api.github.com/repos/krzyzacy/test-infra/branches{/branch}","tags_url":"https://api.github.com/repos/krzyzacy/test-infra/tags","blobs_url":"https://api.github.com/repos/krzyzacy/test-infra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/krzyzacy/test-infra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/krzyzacy/test-infra/git/refs{/sha}","trees_url":"https://api.github.com/repos/krzyzacy/test-infra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/krzyzacy/test-infra/statuses/{sha}","languages_url":"https://api.github.com/repos/krzyzacy/test-infra/languages","stargazers_url":"https://api.github.com/repos/krzyzacy/test-infra/stargazers","contributors_url":"https://api.github.com/repos/krzyzacy/test-infra/contributors","subscribers_url":"https://api.github.com/repos/krzyzacy/test-infra/subscribers","subscription_url":"https://api.github.com/repos/krzyzacy/test-infra/subscription","commits_url":"https://api.github.com/repos/krzyzacy/test-infra/commits{/sha}","git_commits_url":"https://api.github.com/repos/krzyzacy/test-infra/git/commits{/sha}","comments_url":"https://api.github.com/repos/krzyzacy/test-infra/comments{/number}","issue_comment_url":"https://api.github.com/repos/krzyzacy/test-infra/issues/comments{/number}","contents_url":"https://api.github.com/repos/krzyzacy/test-infra/contents/{+path}","compare_url":"https://api.github.com/repos/krzyzacy/test-infra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/krzyzacy/test-infra/merges","archive_url":"https://api.github.com/repos/krzyzacy/test-infra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/krzyzacy/test-infra/downloads","issues_url":"https://api.github.com/repos/krzyzacy/test-infra/issues{/number}","pulls_url":"https://api.github.com/repos/krzyzacy/test-infra/pulls{/number}","milestones_url":"https://api.github.com/repos/krzyzacy/test-infra/milestones{/number}","notifications_url":"https://api.github.com/repos/krzyzacy/test-infra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/krzyzacy/test-infra/labels{/name}","releases_url":"https://api.github.com/repos/krzyzacy/test-infra/releases{/id}","deployments_url":"https://api.github.com/repos/krzyzacy/test-infra/deployments","created_at":"2016-08-11T18:25:52Z","updated_at":"2017-01-21T03:34:56Z","pushed_at":"2018-02-09T23:24:13Z","git_url":"git://github.com/krzyzacy/test-infra.git","ssh_url":"git@github.com:krzyzacy/test-infra.git","clone_url":"https://github.com/krzyzacy/test-infra.git","svn_url":"https://github.com/krzyzacy/test-infra","homepage":null,"size":42089,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"b5007341abe3c98cd4e94408aa1d92c59442a844","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":57333709,"name":"test-infra","full_name":"kubernetes/test-infra","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/test-infra","description":"Test infrastructure for the Kubernetes project.","fork":false,"url":"https://api.github.com/repos/kubernetes/test-infra","forks_url":"https://api.github.com/repos/kubernetes/test-infra/forks","keys_url":"https://api.github.com/repos/kubernetes/test-infra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/test-infra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/test-infra/teams","hooks_url":"https://api.github.com/repos/kubernetes/test-infra/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/test-infra/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/test-infra/events","assignees_url":"https://api.github.com/repos/kubernetes/test-infra/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/test-infra/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/test-infra/tags","blobs_url":"https://api.github.com/repos/kubernetes/test-infra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/test-infra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/test-infra/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/test-infra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/test-infra/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/test-infra/languages","stargazers_url":"https://api.github.com/repos/kubernetes/test-infra/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/test-infra/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/test-infra/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/test-infra/subscription","commits_url":"https://api.github.com/repos/kubernetes/test-infra/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/test-infra/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/test-infra/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/test-infra/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/test-infra/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/test-infra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/test-infra/merges","archive_url":"https://api.github.com/repos/kubernetes/test-infra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/test-infra/downloads","issues_url":"https://api.github.com/repos/kubernetes/test-infra/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/test-infra/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/test-infra/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/test-infra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/test-infra/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/test-infra/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/test-infra/deployments","created_at":"2016-04-28T21:05:35Z","updated_at":"2018-02-09T15:50:04Z","pushed_at":"2018-02-09T23:38:52Z","git_url":"git://github.com/kubernetes/test-infra.git","ssh_url":"git@github.com:kubernetes/test-infra.git","clone_url":"https://github.com/kubernetes/test-infra.git","svn_url":"https://github.com/kubernetes/test-infra","homepage":null,"size":42452,"stargazers_count":256,"watchers_count":256,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":352,"mirror_url":null,"archived":false,"open_issues_count":352,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":352,"open_issues":352,"watchers":256,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/6749"},"html":{"href":"https://github.com/kubernetes/test-infra/pull/6749"},"issue":{"href":"https://api.github.com/repos/kubernetes/test-infra/issues/6749"},"comments":{"href":"https://api.github.com/repos/kubernetes/test-infra/issues/6749/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/6749/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/6749/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/test-infra/statuses/724648a9114eb97b1dd0e3217c107b55934940bc"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"ixdy"}}