{"action":"created","comment":{"url":"https://api.github.com/repos/travis-ci/dpl/pulls/comments/56720752","id":56720752,"diff_hunk":"@@ -44,6 +44,31 @@ def setup_git_ssh(path, key_path)\n         unless context.shell \"./deis git:remote --app=#{option(:app)}\"\n           error 'Adding git remote failed.'\n         end\n+\n+        wait_for_git_access\n+      end\n+\n+      def wait_for_git_access()\n+        retry_count=0\n+        max_retries=30\n+\n+        #Parse out the git remote host and port\n+        git_remote=`cat .git/config  | grep -A1 '[remote] \"deis\"' | tail -n 1 | sed 's/.*url = //'`","path":"lib/dpl/provider/deis.rb","position":13,"original_position":13,"commit_id":"b13877650ac7134e3f4f329b66ff9ce314db863c","original_commit_id":"b13877650ac7134e3f4f329b66ff9ce314db863c","user":{"login":"mattk42","id":505046,"avatar_url":"https://avatars.githubusercontent.com/u/505046?v=3","gravatar_id":"","url":"https://api.github.com/users/mattk42","html_url":"https://github.com/mattk42","followers_url":"https://api.github.com/users/mattk42/followers","following_url":"https://api.github.com/users/mattk42/following{/other_user}","gists_url":"https://api.github.com/users/mattk42/gists{/gist_id}","starred_url":"https://api.github.com/users/mattk42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattk42/subscriptions","organizations_url":"https://api.github.com/users/mattk42/orgs","repos_url":"https://api.github.com/users/mattk42/repos","events_url":"https://api.github.com/users/mattk42/events{/privacy}","received_events_url":"https://api.github.com/users/mattk42/received_events","type":"User","site_admin":false},"body":"I agree, I came back to look at this today and noticed that this is kind of hacky anyway. I just started a branch locally that uses https://github.com/schacon/ruby-git so that it can be mocked out in the specs. If the git remote is empty in any situation outside of rspec I think that there would be something wrong already.","created_at":"2016-03-18T20:53:39Z","updated_at":"2016-03-18T20:53:39Z","html_url":"https://github.com/travis-ci/dpl/pull/402#discussion_r56720752","pull_request_url":"https://api.github.com/repos/travis-ci/dpl/pulls/402","_links":{"self":{"href":"https://api.github.com/repos/travis-ci/dpl/pulls/comments/56720752"},"html":{"href":"https://github.com/travis-ci/dpl/pull/402#discussion_r56720752"},"pull_request":{"href":"https://api.github.com/repos/travis-ci/dpl/pulls/402"}}},"pull_request":{"url":"https://api.github.com/repos/travis-ci/dpl/pulls/402","id":58972373,"html_url":"https://github.com/travis-ci/dpl/pull/402","diff_url":"https://github.com/travis-ci/dpl/pull/402.diff","patch_url":"https://github.com/travis-ci/dpl/pull/402.patch","issue_url":"https://api.github.com/repos/travis-ci/dpl/issues/402","number":402,"state":"open","locked":false,"title":"Add a check to wait for the SSH key to start working","user":{"login":"mattk42","id":505046,"avatar_url":"https://avatars.githubusercontent.com/u/505046?v=3","gravatar_id":"","url":"https://api.github.com/users/mattk42","html_url":"https://github.com/mattk42","followers_url":"https://api.github.com/users/mattk42/followers","following_url":"https://api.github.com/users/mattk42/following{/other_user}","gists_url":"https://api.github.com/users/mattk42/gists{/gist_id}","starred_url":"https://api.github.com/users/mattk42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattk42/subscriptions","organizations_url":"https://api.github.com/users/mattk42/orgs","repos_url":"https://api.github.com/users/mattk42/repos","events_url":"https://api.github.com/users/mattk42/events{/privacy}","received_events_url":"https://api.github.com/users/mattk42/received_events","type":"User","site_admin":false},"body":"This is for #352. Although for some reason just using master seemed to work, it does seem that there is a timing issue that should be explicitly solved.\r\n\r\nThe problem seems to be that Deis reports ssh keys are added slightly before they can actually be used for a code push. In my testing it seems to take < 2 seconds for the key to be usable.\r\n\r\nThis code just gets the deis remote information from the git config file (for some reason `git remove -v show deis` was not working) and attempts to SSH into the remote until it gets a 'PTY allocation request failed message'. That doesn't seem like the cleanest way of going about it, but since you can't actually SSH in it was the only test I could come up with. Seems to work for me.\r\n\r\nEdit: I realize that this doesn't pass tests right now, if this implementation looks ok then I will go and fix the tests.","created_at":"2016-02-10T23:36:49Z","updated_at":"2016-03-18T20:53:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f801d0d71496345784ab00ba217133466ee6e7e3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/travis-ci/dpl/pulls/402/commits","review_comments_url":"https://api.github.com/repos/travis-ci/dpl/pulls/402/comments","review_comment_url":"https://api.github.com/repos/travis-ci/dpl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/travis-ci/dpl/issues/402/comments","statuses_url":"https://api.github.com/repos/travis-ci/dpl/statuses/b13877650ac7134e3f4f329b66ff9ce314db863c","head":{"label":"mattk42:master","ref":"master","sha":"b13877650ac7134e3f4f329b66ff9ce314db863c","user":{"login":"mattk42","id":505046,"avatar_url":"https://avatars.githubusercontent.com/u/505046?v=3","gravatar_id":"","url":"https://api.github.com/users/mattk42","html_url":"https://github.com/mattk42","followers_url":"https://api.github.com/users/mattk42/followers","following_url":"https://api.github.com/users/mattk42/following{/other_user}","gists_url":"https://api.github.com/users/mattk42/gists{/gist_id}","starred_url":"https://api.github.com/users/mattk42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattk42/subscriptions","organizations_url":"https://api.github.com/users/mattk42/orgs","repos_url":"https://api.github.com/users/mattk42/repos","events_url":"https://api.github.com/users/mattk42/events{/privacy}","received_events_url":"https://api.github.com/users/mattk42/received_events","type":"User","site_admin":false},"repo":{"id":51459257,"name":"dpl","full_name":"mattk42/dpl","owner":{"login":"mattk42","id":505046,"avatar_url":"https://avatars.githubusercontent.com/u/505046?v=3","gravatar_id":"","url":"https://api.github.com/users/mattk42","html_url":"https://github.com/mattk42","followers_url":"https://api.github.com/users/mattk42/followers","following_url":"https://api.github.com/users/mattk42/following{/other_user}","gists_url":"https://api.github.com/users/mattk42/gists{/gist_id}","starred_url":"https://api.github.com/users/mattk42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattk42/subscriptions","organizations_url":"https://api.github.com/users/mattk42/orgs","repos_url":"https://api.github.com/users/mattk42/repos","events_url":"https://api.github.com/users/mattk42/events{/privacy}","received_events_url":"https://api.github.com/users/mattk42/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mattk42/dpl","description":"Dpl (dee-pee-ell) is a deploy tool made for continuous deployment.","fork":true,"url":"https://api.github.com/repos/mattk42/dpl","forks_url":"https://api.github.com/repos/mattk42/dpl/forks","keys_url":"https://api.github.com/repos/mattk42/dpl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mattk42/dpl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mattk42/dpl/teams","hooks_url":"https://api.github.com/repos/mattk42/dpl/hooks","issue_events_url":"https://api.github.com/repos/mattk42/dpl/issues/events{/number}","events_url":"https://api.github.com/repos/mattk42/dpl/events","assignees_url":"https://api.github.com/repos/mattk42/dpl/assignees{/user}","branches_url":"https://api.github.com/repos/mattk42/dpl/branches{/branch}","tags_url":"https://api.github.com/repos/mattk42/dpl/tags","blobs_url":"https://api.github.com/repos/mattk42/dpl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mattk42/dpl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mattk42/dpl/git/refs{/sha}","trees_url":"https://api.github.com/repos/mattk42/dpl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mattk42/dpl/statuses/{sha}","languages_url":"https://api.github.com/repos/mattk42/dpl/languages","stargazers_url":"https://api.github.com/repos/mattk42/dpl/stargazers","contributors_url":"https://api.github.com/repos/mattk42/dpl/contributors","subscribers_url":"https://api.github.com/repos/mattk42/dpl/subscribers","subscription_url":"https://api.github.com/repos/mattk42/dpl/subscription","commits_url":"https://api.github.com/repos/mattk42/dpl/commits{/sha}","git_commits_url":"https://api.github.com/repos/mattk42/dpl/git/commits{/sha}","comments_url":"https://api.github.com/repos/mattk42/dpl/comments{/number}","issue_comment_url":"https://api.github.com/repos/mattk42/dpl/issues/comments{/number}","contents_url":"https://api.github.com/repos/mattk42/dpl/contents/{+path}","compare_url":"https://api.github.com/repos/mattk42/dpl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mattk42/dpl/merges","archive_url":"https://api.github.com/repos/mattk42/dpl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mattk42/dpl/downloads","issues_url":"https://api.github.com/repos/mattk42/dpl/issues{/number}","pulls_url":"https://api.github.com/repos/mattk42/dpl/pulls{/number}","milestones_url":"https://api.github.com/repos/mattk42/dpl/milestones{/number}","notifications_url":"https://api.github.com/repos/mattk42/dpl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mattk42/dpl/labels{/name}","releases_url":"https://api.github.com/repos/mattk42/dpl/releases{/id}","deployments_url":"https://api.github.com/repos/mattk42/dpl/deployments","created_at":"2016-02-10T17:49:34Z","updated_at":"2016-02-10T17:49:35Z","pushed_at":"2016-03-18T19:08:20Z","git_url":"git://github.com/mattk42/dpl.git","ssh_url":"git@github.com:mattk42/dpl.git","clone_url":"https://github.com/mattk42/dpl.git","svn_url":"https://github.com/mattk42/dpl","homepage":"","size":1835,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"travis-ci:master","ref":"master","sha":"2bf330d86c4503247815d0dd7a830882d9225888","user":{"login":"travis-ci","id":639823,"avatar_url":"https://avatars.githubusercontent.com/u/639823?v=3","gravatar_id":"","url":"https://api.github.com/users/travis-ci","html_url":"https://github.com/travis-ci","followers_url":"https://api.github.com/users/travis-ci/followers","following_url":"https://api.github.com/users/travis-ci/following{/other_user}","gists_url":"https://api.github.com/users/travis-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/travis-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/travis-ci/subscriptions","organizations_url":"https://api.github.com/users/travis-ci/orgs","repos_url":"https://api.github.com/users/travis-ci/repos","events_url":"https://api.github.com/users/travis-ci/events{/privacy}","received_events_url":"https://api.github.com/users/travis-ci/received_events","type":"Organization","site_admin":false},"repo":{"id":10312708,"name":"dpl","full_name":"travis-ci/dpl","owner":{"login":"travis-ci","id":639823,"avatar_url":"https://avatars.githubusercontent.com/u/639823?v=3","gravatar_id":"","url":"https://api.github.com/users/travis-ci","html_url":"https://github.com/travis-ci","followers_url":"https://api.github.com/users/travis-ci/followers","following_url":"https://api.github.com/users/travis-ci/following{/other_user}","gists_url":"https://api.github.com/users/travis-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/travis-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/travis-ci/subscriptions","organizations_url":"https://api.github.com/users/travis-ci/orgs","repos_url":"https://api.github.com/users/travis-ci/repos","events_url":"https://api.github.com/users/travis-ci/events{/privacy}","received_events_url":"https://api.github.com/users/travis-ci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/travis-ci/dpl","description":"Dpl (dee-pee-ell) is a deploy tool made for continuous deployment.","fork":false,"url":"https://api.github.com/repos/travis-ci/dpl","forks_url":"https://api.github.com/repos/travis-ci/dpl/forks","keys_url":"https://api.github.com/repos/travis-ci/dpl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/travis-ci/dpl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/travis-ci/dpl/teams","hooks_url":"https://api.github.com/repos/travis-ci/dpl/hooks","issue_events_url":"https://api.github.com/repos/travis-ci/dpl/issues/events{/number}","events_url":"https://api.github.com/repos/travis-ci/dpl/events","assignees_url":"https://api.github.com/repos/travis-ci/dpl/assignees{/user}","branches_url":"https://api.github.com/repos/travis-ci/dpl/branches{/branch}","tags_url":"https://api.github.com/repos/travis-ci/dpl/tags","blobs_url":"https://api.github.com/repos/travis-ci/dpl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/travis-ci/dpl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/travis-ci/dpl/git/refs{/sha}","trees_url":"https://api.github.com/repos/travis-ci/dpl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/travis-ci/dpl/statuses/{sha}","languages_url":"https://api.github.com/repos/travis-ci/dpl/languages","stargazers_url":"https://api.github.com/repos/travis-ci/dpl/stargazers","contributors_url":"https://api.github.com/repos/travis-ci/dpl/contributors","subscribers_url":"https://api.github.com/repos/travis-ci/dpl/subscribers","subscription_url":"https://api.github.com/repos/travis-ci/dpl/subscription","commits_url":"https://api.github.com/repos/travis-ci/dpl/commits{/sha}","git_commits_url":"https://api.github.com/repos/travis-ci/dpl/git/commits{/sha}","comments_url":"https://api.github.com/repos/travis-ci/dpl/comments{/number}","issue_comment_url":"https://api.github.com/repos/travis-ci/dpl/issues/comments{/number}","contents_url":"https://api.github.com/repos/travis-ci/dpl/contents/{+path}","compare_url":"https://api.github.com/repos/travis-ci/dpl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/travis-ci/dpl/merges","archive_url":"https://api.github.com/repos/travis-ci/dpl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/travis-ci/dpl/downloads","issues_url":"https://api.github.com/repos/travis-ci/dpl/issues{/number}","pulls_url":"https://api.github.com/repos/travis-ci/dpl/pulls{/number}","milestones_url":"https://api.github.com/repos/travis-ci/dpl/milestones{/number}","notifications_url":"https://api.github.com/repos/travis-ci/dpl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/travis-ci/dpl/labels{/name}","releases_url":"https://api.github.com/repos/travis-ci/dpl/releases{/id}","deployments_url":"https://api.github.com/repos/travis-ci/dpl/deployments","created_at":"2013-05-27T10:26:39Z","updated_at":"2016-03-16T16:45:57Z","pushed_at":"2016-03-18T19:08:21Z","git_url":"git://github.com/travis-ci/dpl.git","ssh_url":"git@github.com:travis-ci/dpl.git","clone_url":"https://github.com/travis-ci/dpl.git","svn_url":"https://github.com/travis-ci/dpl","homepage":"","size":1989,"stargazers_count":299,"watchers_count":299,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":159,"mirror_url":null,"open_issues_count":77,"forks":159,"open_issues":77,"watchers":299,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/travis-ci/dpl/pulls/402"},"html":{"href":"https://github.com/travis-ci/dpl/pull/402"},"issue":{"href":"https://api.github.com/repos/travis-ci/dpl/issues/402"},"comments":{"href":"https://api.github.com/repos/travis-ci/dpl/issues/402/comments"},"review_comments":{"href":"https://api.github.com/repos/travis-ci/dpl/pulls/402/comments"},"review_comment":{"href":"https://api.github.com/repos/travis-ci/dpl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/travis-ci/dpl/pulls/402/commits"},"statuses":{"href":"https://api.github.com/repos/travis-ci/dpl/statuses/b13877650ac7134e3f4f329b66ff9ce314db863c"}}}}