{"action":"created","comment":{"url":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/comments/87217193","pull_request_review_id":7837498,"id":87217193,"diff_hunk":"@@ -0,0 +1,163 @@\n+package download\n+\n+import (\n+\t\"fmt\"\n+\t\"log\"\n+\t\"net/http\"\n+\t\"os\"\n+\t\"strings\"\n+\t\"time\"\n+\n+\t\"github.com/alexandrasp/taskcluster-cli/extpoints\"\n+\t\"github.com/taskcluster/httpbackoff\"\n+\t\"github.com/taskcluster/taskcluster-client-go\"\n+\t\"github.com/taskcluster/taskcluster-client-go/queue\"\n+)\n+\n+//\"github.com/taskcluster/httpbackoff\"\n+\n+func init() {\n+\textpoints.Register(\"download\", download{})\n+}\n+\n+type download struct{}\n+\n+func (download) ConfigOptions() map[string]extpoints.ConfigOption {\n+\treturn nil\n+}\n+\n+func (download) Summary() string {\n+\treturn \"Download an artifact\"\n+}\n+\n+func usageDownload() string {\n+\treturn `Usage:\n+\t\t\ttaskcluster download [options]\n+\t\t\tOptions:\n+\t\t\t<taskId> [<runId>] <artifact>\n+\t\t\t`\n+}\n+\n+func (download) Usage() string {\n+\treturn usageDownload()\n+}\n+\n+func (download) Execute(context extpoints.Context) bool {\n+\tcommand := context.Arguments[\"download\"].(string)\n+\ttaskId := context.Arguments[\"<taskId>\"].(string)\n+\trunId := context.Arguments[\"<runId>\"].(string)\n+\tartifact := context.Arguments[\"<artifact>\"].(string)\n+\n+\tprovider := extpoints.CommandProviders()[command]\n+\tif provider == nil {\n+\t\tlog.Panicf(\"Unknown command %s\", command)\n+\n+\t} else {\n+\n+\t\tpermaCred := &tcclient.Credentials{\n+\t\t\tClientID:    os.Getenv(\"TASKCLUSTER_CLIENT_ID\"),\n+\t\t\tAccessToken: os.Getenv(\"TASKCLUSTER_ACCESS_TOKEN\"),\n+\t\t}\n+\n+\t\tuserQueue := queue.New(permaCred)\n+\n+\t\tif runId != \"\" {\n+\t\t\t//get a artifact with runId parameter\n+\t\t\turl_artifact, err := userQueue.GetArtifact_SignedURL(taskId, runId, artifact, time.Second*10)\n+\t\t\tif err != nil {\n+\t\t\t\tlog.Panicf(\"Exception thrown signing URL \\n%s\", err)\n+\t\t\t} else {\n+","path":"download/download.go","position":null,"original_position":70,"commit_id":"d095946738c2ceb71a9c05b5b0f63b2cb044b8d9","original_commit_id":"aacf1210fd9a67c0c235b7e432a8fc48f515a961","user":{"login":"alexandrasp","id":6344218,"avatar_url":"https://avatars.githubusercontent.com/u/6344218?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandrasp","html_url":"https://github.com/alexandrasp","followers_url":"https://api.github.com/users/alexandrasp/followers","following_url":"https://api.github.com/users/alexandrasp/following{/other_user}","gists_url":"https://api.github.com/users/alexandrasp/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandrasp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandrasp/subscriptions","organizations_url":"https://api.github.com/users/alexandrasp/orgs","repos_url":"https://api.github.com/users/alexandrasp/repos","events_url":"https://api.github.com/users/alexandrasp/events{/privacy}","received_events_url":"https://api.github.com/users/alexandrasp/received_events","type":"User","site_admin":false},"body":"fixed","created_at":"2016-11-09T15:45:26Z","updated_at":"2016-11-09T15:45:26Z","html_url":"https://github.com/taskcluster/taskcluster-cli/pull/37#discussion_r87217193","pull_request_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/37","_links":{"self":{"href":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/comments/87217193"},"html":{"href":"https://github.com/taskcluster/taskcluster-cli/pull/37#discussion_r87217193"},"pull_request":{"href":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/37"}}},"pull_request":{"url":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/37","id":89324071,"html_url":"https://github.com/taskcluster/taskcluster-cli/pull/37","diff_url":"https://github.com/taskcluster/taskcluster-cli/pull/37.diff","patch_url":"https://github.com/taskcluster/taskcluster-cli/pull/37.patch","issue_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/issues/37","number":37,"state":"open","locked":false,"title":"command to download an arctifact and features","user":{"login":"alexandrasp","id":6344218,"avatar_url":"https://avatars.githubusercontent.com/u/6344218?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandrasp","html_url":"https://github.com/alexandrasp","followers_url":"https://api.github.com/users/alexandrasp/followers","following_url":"https://api.github.com/users/alexandrasp/following{/other_user}","gists_url":"https://api.github.com/users/alexandrasp/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandrasp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandrasp/subscriptions","organizations_url":"https://api.github.com/users/alexandrasp/orgs","repos_url":"https://api.github.com/users/alexandrasp/repos","events_url":"https://api.github.com/users/alexandrasp/events{/privacy}","received_events_url":"https://api.github.com/users/alexandrasp/received_events","type":"User","site_admin":false},"body":"download command implementation. It is a new implementation from Command Provider interface, to do request from a URL and download a artifact from this by automatic retries and using exponential backoff. \n\nNow with checking content length, follow redirects implementation too, enforcing https\n","created_at":"2016-10-14T04:47:11Z","updated_at":"2016-11-09T15:45:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f1c4b77c8f5cbb1a57467780282679f2de10b26","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/37/commits","review_comments_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/37/comments","review_comment_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/issues/37/comments","statuses_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/statuses/d095946738c2ceb71a9c05b5b0f63b2cb044b8d9","head":{"label":"alexandrasp:master","ref":"master","sha":"d095946738c2ceb71a9c05b5b0f63b2cb044b8d9","user":{"login":"alexandrasp","id":6344218,"avatar_url":"https://avatars.githubusercontent.com/u/6344218?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandrasp","html_url":"https://github.com/alexandrasp","followers_url":"https://api.github.com/users/alexandrasp/followers","following_url":"https://api.github.com/users/alexandrasp/following{/other_user}","gists_url":"https://api.github.com/users/alexandrasp/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandrasp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandrasp/subscriptions","organizations_url":"https://api.github.com/users/alexandrasp/orgs","repos_url":"https://api.github.com/users/alexandrasp/repos","events_url":"https://api.github.com/users/alexandrasp/events{/privacy}","received_events_url":"https://api.github.com/users/alexandrasp/received_events","type":"User","site_admin":false},"repo":{"id":69778042,"name":"taskcluster-cli","full_name":"alexandrasp/taskcluster-cli","owner":{"login":"alexandrasp","id":6344218,"avatar_url":"https://avatars.githubusercontent.com/u/6344218?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandrasp","html_url":"https://github.com/alexandrasp","followers_url":"https://api.github.com/users/alexandrasp/followers","following_url":"https://api.github.com/users/alexandrasp/following{/other_user}","gists_url":"https://api.github.com/users/alexandrasp/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandrasp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandrasp/subscriptions","organizations_url":"https://api.github.com/users/alexandrasp/orgs","repos_url":"https://api.github.com/users/alexandrasp/repos","events_url":"https://api.github.com/users/alexandrasp/events{/privacy}","received_events_url":"https://api.github.com/users/alexandrasp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexandrasp/taskcluster-cli","description":"Taskcluster CLI","fork":true,"url":"https://api.github.com/repos/alexandrasp/taskcluster-cli","forks_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/forks","keys_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/teams","hooks_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/hooks","issue_events_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/issues/events{/number}","events_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/events","assignees_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/assignees{/user}","branches_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/branches{/branch}","tags_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/tags","blobs_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/languages","stargazers_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/stargazers","contributors_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/contributors","subscribers_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/subscribers","subscription_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/subscription","commits_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/contents/{+path}","compare_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/merges","archive_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/downloads","issues_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/issues{/number}","pulls_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/labels{/name}","releases_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/releases{/id}","deployments_url":"https://api.github.com/repos/alexandrasp/taskcluster-cli/deployments","created_at":"2016-10-02T04:04:27Z","updated_at":"2016-10-02T04:04:29Z","pushed_at":"2016-11-09T15:42:19Z","git_url":"git://github.com/alexandrasp/taskcluster-cli.git","ssh_url":"git@github.com:alexandrasp/taskcluster-cli.git","clone_url":"https://github.com/alexandrasp/taskcluster-cli.git","svn_url":"https://github.com/alexandrasp/taskcluster-cli","homepage":"","size":126,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"taskcluster:master","ref":"master","sha":"526f694ae513ddf212dd13bc3e02c0b2edc8de54","user":{"login":"taskcluster","id":6257436,"avatar_url":"https://avatars.githubusercontent.com/u/6257436?v=3","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"repo":{"id":23059043,"name":"taskcluster-cli","full_name":"taskcluster/taskcluster-cli","owner":{"login":"taskcluster","id":6257436,"avatar_url":"https://avatars.githubusercontent.com/u/6257436?v=3","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/taskcluster/taskcluster-cli","description":"Taskcluster CLI","fork":false,"url":"https://api.github.com/repos/taskcluster/taskcluster-cli","forks_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/forks","keys_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/teams","hooks_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/hooks","issue_events_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/issues/events{/number}","events_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/events","assignees_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/assignees{/user}","branches_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/branches{/branch}","tags_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/tags","blobs_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/languages","stargazers_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/stargazers","contributors_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/contributors","subscribers_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/subscribers","subscription_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/subscription","commits_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/contents/{+path}","compare_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/merges","archive_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/downloads","issues_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/issues{/number}","pulls_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/labels{/name}","releases_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/releases{/id}","deployments_url":"https://api.github.com/repos/taskcluster/taskcluster-cli/deployments","created_at":"2014-08-18T04:50:46Z","updated_at":"2016-10-08T18:59:12Z","pushed_at":"2016-11-09T15:42:20Z","git_url":"git://github.com/taskcluster/taskcluster-cli.git","ssh_url":"git@github.com:taskcluster/taskcluster-cli.git","clone_url":"https://github.com/taskcluster/taskcluster-cli.git","svn_url":"https://github.com/taskcluster/taskcluster-cli","homepage":"","size":126,"stargazers_count":9,"watchers_count":9,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":16,"forks":16,"open_issues":16,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/37"},"html":{"href":"https://github.com/taskcluster/taskcluster-cli/pull/37"},"issue":{"href":"https://api.github.com/repos/taskcluster/taskcluster-cli/issues/37"},"comments":{"href":"https://api.github.com/repos/taskcluster/taskcluster-cli/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/taskcluster/taskcluster-cli/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/taskcluster/taskcluster-cli/statuses/d095946738c2ceb71a9c05b5b0f63b2cb044b8d9"}}}}
{"actor":{"display_login":"alexandrasp"}}