{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/nomad/pulls/comments/42736402","id":42736402,"diff_hunk":"@@ -41,12 +47,43 @@ func (d *ExecDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool,\n }\n \n func (d *ExecDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error) {\n-\t// Get the command\n+\t// Get the command to be ran, or if omitted, download an artifact for\n+\t// execution. Currently a supplied command takes precedence, and an artifact\n+\t// is only downloaded if no command is supplied\n \tcommand, ok := task.Config[\"command\"]\n \tif !ok || command == \"\" {\n \t\treturn nil, fmt.Errorf(\"missing command for exec driver\")\n \t}\n \n+\tsource, ok := task.Config[\"artifact_source\"]\n+\tif ok && source != \"\" {\n+\t\t// Proceed to download an artifact to be executed.\n+\t\t// We use go-getter to support a variety of protocols, but need to change\n+\t\t// file permissions of the resulted download to be executable\n+\n+\t\t// Create a location to download the artifact.\n+\t\ttaskDir, ok := ctx.AllocDir.TaskDirs[d.DriverContext.taskName]\n+\t\tif !ok {\n+\t\t\treturn nil, fmt.Errorf(\"[Err] driver.Exec: Could not find task directory for task: %v\", d.DriverContext.taskName)\n+\t\t}\n+\t\tdestDir := filepath.Join(taskDir, allocdir.TaskLocal)\n+\n+\t\tartifactName := path.Base(source)\n+\t\tartifactFile := filepath.Join(destDir, artifactName)\n+\t\tif err := getter.GetFile(artifactFile, source); err != nil {\n+\t\t\treturn nil, fmt.Errorf(\"[Err] driver.Exec: Error downloading source for Exec driver: %s\", err)\n+\t\t}\n+\n+\t\t// Add execution permissions to the newly downloaded artifact\n+\t\tcmd := exec.Command(\"chmod\", \"+x\", artifactFile)\n+\t\tif err := cmd.Run(); err != nil {\n+\t\t\tlog.Printf(\"[Err] driver.Exec: Error making artifact executable: %s\", err)\n+\t\t}\n+\n+\t\t// re-assign the command to be the local execution path\n+\t\tcommand = filepath.Join(allocdir.TaskLocal, command)","path":"client/driver/exec.go","position":null,"original_position":56,"commit_id":"791dd25b5a8dc15e1988d182c3dabbc92d4daed2","original_commit_id":"83fd1d081fe0b8ee177c23a3978f8288829f534b","user":{"login":"catsby","id":61721,"avatar_url":"https://avatars.githubusercontent.com/u/61721?v=3","gravatar_id":"","url":"https://api.github.com/users/catsby","html_url":"https://github.com/catsby","followers_url":"https://api.github.com/users/catsby/followers","following_url":"https://api.github.com/users/catsby/following{/other_user}","gists_url":"https://api.github.com/users/catsby/gists{/gist_id}","starred_url":"https://api.github.com/users/catsby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/catsby/subscriptions","organizations_url":"https://api.github.com/users/catsby/orgs","repos_url":"https://api.github.com/users/catsby/repos","events_url":"https://api.github.com/users/catsby/events{/privacy}","received_events_url":"https://api.github.com/users/catsby/received_events","type":"User","site_admin":false},"body":"I can't seem to run the tests on my mac:\r\n\r\n```\r\n$ sudo go test -v ./client/driver -run=\"TestExecDriver_Start_Artifact_Wait\"\r\nclient/driver/docker.go:11:2: cannot find package \"github.com/fsouza/go-dockerclient\" in any of:\r\n    /usr/local/go-versions/go1.4.3/src/github.com/fsouza/go-dockerclient (from $GOROOT)\r\n    ($GOPATH not set)\r\n```\r\n\r\nI definitely have github.com/fsouza/go-dockerclient and it's up to date ... `make updatedeps` reports nothing as well. \r\n\r\n> I am not sure it will find the binary.\r\n\r\nIs there a key difference here that would prevent it from working the same as in Linux here? Specifically on a Mac","created_at":"2015-10-22T11:23:00Z","updated_at":"2015-10-22T11:23:00Z","html_url":"https://github.com/hashicorp/nomad/pull/288#discussion_r42736402","pull_request_url":"https://api.github.com/repos/hashicorp/nomad/pulls/288","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/nomad/pulls/comments/42736402"},"html":{"href":"https://github.com/hashicorp/nomad/pull/288#discussion_r42736402"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/nomad/pulls/288"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/nomad/pulls/288","id":47845661,"html_url":"https://github.com/hashicorp/nomad/pull/288","diff_url":"https://github.com/hashicorp/nomad/pull/288.diff","patch_url":"https://github.com/hashicorp/nomad/pull/288.patch","issue_url":"https://api.github.com/repos/hashicorp/nomad/issues/288","number":288,"state":"open","locked":false,"title":"Drivers: Use go-getter","user":{"login":"catsby","id":61721,"avatar_url":"https://avatars.githubusercontent.com/u/61721?v=3","gravatar_id":"","url":"https://api.github.com/users/catsby","html_url":"https://github.com/catsby","followers_url":"https://api.github.com/users/catsby/followers","following_url":"https://api.github.com/users/catsby/following{/other_user}","gists_url":"https://api.github.com/users/catsby/gists{/gist_id}","starred_url":"https://api.github.com/users/catsby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/catsby/subscriptions","organizations_url":"https://api.github.com/users/catsby/orgs","repos_url":"https://api.github.com/users/catsby/repos","events_url":"https://api.github.com/users/catsby/events{/privacy}","received_events_url":"https://api.github.com/users/catsby/received_events","type":"User","site_admin":false},"body":":construction: \r\n\r\nConverts the Java task driver to use github.com/hashicorp/go-getter instead of the in-line `http.Get`. \r\n\r\nWorking on Qemu and others next\r\n\r\n- [x] Java\r\n- [x] Qemu\r\n- [x] exec\r\n- [x] raw_exec\r\n- [x] Docs","created_at":"2015-10-15T21:41:20Z","updated_at":"2015-10-22T11:23:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b12e847b827940016060b427ea6d8f6894dc261","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/nomad/pulls/288/commits","review_comments_url":"https://api.github.com/repos/hashicorp/nomad/pulls/288/comments","review_comment_url":"https://api.github.com/repos/hashicorp/nomad/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/nomad/issues/288/comments","statuses_url":"https://api.github.com/repos/hashicorp/nomad/statuses/791dd25b5a8dc15e1988d182c3dabbc92d4daed2","head":{"label":"hashicorp:f-go-getter","ref":"f-go-getter","sha":"791dd25b5a8dc15e1988d182c3dabbc92d4daed2","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":36653430,"name":"nomad","full_name":"hashicorp/nomad","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/nomad","description":"A Distributed, Highly Available, Datacenter-Aware Scheduler","fork":false,"url":"https://api.github.com/repos/hashicorp/nomad","forks_url":"https://api.github.com/repos/hashicorp/nomad/forks","keys_url":"https://api.github.com/repos/hashicorp/nomad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/nomad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/nomad/teams","hooks_url":"https://api.github.com/repos/hashicorp/nomad/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/nomad/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/nomad/events","assignees_url":"https://api.github.com/repos/hashicorp/nomad/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/nomad/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/nomad/tags","blobs_url":"https://api.github.com/repos/hashicorp/nomad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/nomad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/nomad/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/nomad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/nomad/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/nomad/languages","stargazers_url":"https://api.github.com/repos/hashicorp/nomad/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/nomad/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/nomad/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/nomad/subscription","commits_url":"https://api.github.com/repos/hashicorp/nomad/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/nomad/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/nomad/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/nomad/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/nomad/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/nomad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/nomad/merges","archive_url":"https://api.github.com/repos/hashicorp/nomad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/nomad/downloads","issues_url":"https://api.github.com/repos/hashicorp/nomad/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/nomad/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/nomad/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/nomad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/nomad/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/nomad/releases{/id}","created_at":"2015-06-01T10:21:00Z","updated_at":"2015-10-21T19:45:07Z","pushed_at":"2015-10-22T11:11:25Z","git_url":"git://github.com/hashicorp/nomad.git","ssh_url":"git@github.com:hashicorp/nomad.git","clone_url":"https://github.com/hashicorp/nomad.git","svn_url":"https://github.com/hashicorp/nomad","homepage":"https://www.nomadproject.io/","size":19204,"stargazers_count":934,"watchers_count":934,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":64,"mirror_url":null,"open_issues_count":66,"forks":64,"open_issues":66,"watchers":934,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"fd3dccead257b42110e58543e8f39ecafe34e21d","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":36653430,"name":"nomad","full_name":"hashicorp/nomad","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/nomad","description":"A Distributed, Highly Available, Datacenter-Aware Scheduler","fork":false,"url":"https://api.github.com/repos/hashicorp/nomad","forks_url":"https://api.github.com/repos/hashicorp/nomad/forks","keys_url":"https://api.github.com/repos/hashicorp/nomad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/nomad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/nomad/teams","hooks_url":"https://api.github.com/repos/hashicorp/nomad/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/nomad/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/nomad/events","assignees_url":"https://api.github.com/repos/hashicorp/nomad/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/nomad/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/nomad/tags","blobs_url":"https://api.github.com/repos/hashicorp/nomad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/nomad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/nomad/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/nomad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/nomad/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/nomad/languages","stargazers_url":"https://api.github.com/repos/hashicorp/nomad/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/nomad/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/nomad/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/nomad/subscription","commits_url":"https://api.github.com/repos/hashicorp/nomad/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/nomad/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/nomad/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/nomad/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/nomad/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/nomad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/nomad/merges","archive_url":"https://api.github.com/repos/hashicorp/nomad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/nomad/downloads","issues_url":"https://api.github.com/repos/hashicorp/nomad/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/nomad/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/nomad/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/nomad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/nomad/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/nomad/releases{/id}","created_at":"2015-06-01T10:21:00Z","updated_at":"2015-10-21T19:45:07Z","pushed_at":"2015-10-22T11:11:25Z","git_url":"git://github.com/hashicorp/nomad.git","ssh_url":"git@github.com:hashicorp/nomad.git","clone_url":"https://github.com/hashicorp/nomad.git","svn_url":"https://github.com/hashicorp/nomad","homepage":"https://www.nomadproject.io/","size":19204,"stargazers_count":934,"watchers_count":934,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":64,"mirror_url":null,"open_issues_count":66,"forks":64,"open_issues":66,"watchers":934,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/nomad/pulls/288"},"html":{"href":"https://github.com/hashicorp/nomad/pull/288"},"issue":{"href":"https://api.github.com/repos/hashicorp/nomad/issues/288"},"comments":{"href":"https://api.github.com/repos/hashicorp/nomad/issues/288/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/nomad/pulls/288/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/nomad/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/nomad/pulls/288/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/nomad/statuses/791dd25b5a8dc15e1988d182c3dabbc92d4daed2"}}}}