{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/comments/66149803","id":66149803,"diff_hunk":"@@ -66,17 +77,41 @@ protected ExternalWorkspace run() throws Exception {\n             }\n \n             String pathOnDisk = computePathOnDisk(physicalPathOnDisk);\n-            ExternalWorkspace exws = new ExternalWorkspace(diskPoolId, diskId, pathOnDisk);\n-\n-            listener.getLogger().println(format(\"Selected Disk ID '%s' from the Disk Pool ID '%s'\", exws.getDiskId(), exws.getDiskPoolId()));\n-            listener.getLogger().println(format(\"The path on Disk is: %s\", exws.getPathOnDisk()));\n-\n-            return exws;\n+            exws = new ExternalWorkspace(diskPoolId, diskId, pathOnDisk);\n         } else {\n             // this is the downstream job\n-            // TODO implement\n-            return null;\n+\n+            Item upstreamJob = findUpstreamJob(upstreamName);\n+            if (upstreamJob == null) {\n+                throw new AbortException(format(\"There isn't any upstream job associated with '%s'\", upstreamName));\n+            }\n+            Run lastStableBuild = ((Job) upstreamJob).getLastStableBuild();\n+            if (lastStableBuild == null) {\n+                throw new AbortException(format(\"'%s' doesn't have any stable build\", upstreamName));\n+            }\n+            if (!(lastStableBuild instanceof WorkflowRun)) {\n+                throw new AbortException(format(\"Build '%s' is not a Pipeline job. Can't read the run actions\", lastStableBuild));\n+            }\n+\n+            FlowExecution flowExecution = ((WorkflowRun) lastStableBuild).getExecution();\n+            if (flowExecution == null) {\n+                throw new Exception(\"Upstream flow execution is null\");","path":"src/main/java/org/jenkinsci/plugins/ewm/steps/ExwsAllocateExecution.java","position":70,"original_position":70,"commit_id":"bd8a5bbb7d450f1128b1358b45ac3f7e09f52515","original_commit_id":"bd8a5bbb7d450f1128b1358b45ac3f7e09f52515","user":{"login":"martinda","id":164060,"avatar_url":"https://avatars.githubusercontent.com/u/164060?v=3","gravatar_id":"","url":"https://api.github.com/users/martinda","html_url":"https://github.com/martinda","followers_url":"https://api.github.com/users/martinda/followers","following_url":"https://api.github.com/users/martinda/following{/other_user}","gists_url":"https://api.github.com/users/martinda/gists{/gist_id}","starred_url":"https://api.github.com/users/martinda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinda/subscriptions","organizations_url":"https://api.github.com/users/martinda/orgs","repos_url":"https://api.github.com/users/martinda/repos","events_url":"https://api.github.com/users/martinda/events{/privacy}","received_events_url":"https://api.github.com/users/martinda/received_events","type":"User","site_admin":false},"body":"This is my ignorance asking: why `Exception` here, and `AbortException` in the other ones? Maybe this is temporary until you create the custom exception?","created_at":"2016-06-07T20:48:45Z","updated_at":"2016-06-07T20:48:45Z","html_url":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/8#discussion_r66149803","pull_request_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/comments/66149803"},"html":{"href":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/8#discussion_r66149803"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/8","id":72728146,"html_url":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/8","diff_url":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/8.diff","patch_url":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/8.patch","issue_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/8","number":8,"state":"open","locked":false,"title":"[JENKINS-35281] Implement the exwsAllocate step for the downstream job","user":{"login":"alexsomai","id":5720977,"avatar_url":"https://avatars.githubusercontent.com/u/5720977?v=3","gravatar_id":"","url":"https://api.github.com/users/alexsomai","html_url":"https://github.com/alexsomai","followers_url":"https://api.github.com/users/alexsomai/followers","following_url":"https://api.github.com/users/alexsomai/following{/other_user}","gists_url":"https://api.github.com/users/alexsomai/gists{/gist_id}","starred_url":"https://api.github.com/users/alexsomai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexsomai/subscriptions","organizations_url":"https://api.github.com/users/alexsomai/orgs","repos_url":"https://api.github.com/users/alexsomai/repos","events_url":"https://api.github.com/users/alexsomai/events{/privacy}","received_events_url":"https://api.github.com/users/alexsomai/received_events","type":"User","site_admin":false},"body":"The implementation for the exwsAllocate step, the downstream job.\r\nhttps://issues.jenkins-ci.org/browse/JENKINS-35281","created_at":"2016-06-06T15:24:14Z","updated_at":"2016-06-07T20:48:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d929cc7f8a2a73e4b3d92570a322b0356e2dbd63","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/8/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/8/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/8/comments","statuses_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/statuses/bd8a5bbb7d450f1128b1358b45ac3f7e09f52515","head":{"label":"alexsomai:exws-allocate-downstream","ref":"exws-allocate-downstream","sha":"bd8a5bbb7d450f1128b1358b45ac3f7e09f52515","user":{"login":"alexsomai","id":5720977,"avatar_url":"https://avatars.githubusercontent.com/u/5720977?v=3","gravatar_id":"","url":"https://api.github.com/users/alexsomai","html_url":"https://github.com/alexsomai","followers_url":"https://api.github.com/users/alexsomai/followers","following_url":"https://api.github.com/users/alexsomai/following{/other_user}","gists_url":"https://api.github.com/users/alexsomai/gists{/gist_id}","starred_url":"https://api.github.com/users/alexsomai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexsomai/subscriptions","organizations_url":"https://api.github.com/users/alexsomai/orgs","repos_url":"https://api.github.com/users/alexsomai/repos","events_url":"https://api.github.com/users/alexsomai/events{/privacy}","received_events_url":"https://api.github.com/users/alexsomai/received_events","type":"User","site_admin":false},"repo":{"id":59319962,"name":"external-workspace-manager-plugin","full_name":"alexsomai/external-workspace-manager-plugin","owner":{"login":"alexsomai","id":5720977,"avatar_url":"https://avatars.githubusercontent.com/u/5720977?v=3","gravatar_id":"","url":"https://api.github.com/users/alexsomai","html_url":"https://github.com/alexsomai","followers_url":"https://api.github.com/users/alexsomai/followers","following_url":"https://api.github.com/users/alexsomai/following{/other_user}","gists_url":"https://api.github.com/users/alexsomai/gists{/gist_id}","starred_url":"https://api.github.com/users/alexsomai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexsomai/subscriptions","organizations_url":"https://api.github.com/users/alexsomai/orgs","repos_url":"https://api.github.com/users/alexsomai/repos","events_url":"https://api.github.com/users/alexsomai/events{/privacy}","received_events_url":"https://api.github.com/users/alexsomai/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexsomai/external-workspace-manager-plugin","description":"","fork":true,"url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin","forks_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/forks","keys_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/teams","hooks_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/hooks","issue_events_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/events","assignees_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/tags","blobs_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/languages","stargazers_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/stargazers","contributors_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/contributors","subscribers_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/subscribers","subscription_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/subscription","commits_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/merges","archive_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/downloads","issues_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/labels{/name}","releases_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/deployments","created_at":"2016-05-20T19:11:36Z","updated_at":"2016-06-07T17:30:42Z","pushed_at":"2016-06-07T20:38:47Z","git_url":"git://github.com/alexsomai/external-workspace-manager-plugin.git","ssh_url":"git@github.com:alexsomai/external-workspace-manager-plugin.git","clone_url":"https://github.com/alexsomai/external-workspace-manager-plugin.git","svn_url":"https://github.com/alexsomai/external-workspace-manager-plugin","homepage":"","size":61,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"jenkinsci:exws-step","ref":"exws-step","sha":"8507d271399b594845b16dd95e02980f64d126f4","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":58932444,"name":"external-workspace-manager-plugin","full_name":"jenkinsci/external-workspace-manager-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/external-workspace-manager-plugin","description":"","fork":false,"url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin","forks_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/deployments","created_at":"2016-05-16T12:57:04Z","updated_at":"2016-06-07T18:51:49Z","pushed_at":"2016-06-07T20:42:32Z","git_url":"git://github.com/jenkinsci/external-workspace-manager-plugin.git","ssh_url":"git@github.com:jenkinsci/external-workspace-manager-plugin.git","clone_url":"https://github.com/jenkinsci/external-workspace-manager-plugin.git","svn_url":"https://github.com/jenkinsci/external-workspace-manager-plugin","homepage":"","size":61,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":3,"forks":3,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/8"},"html":{"href":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/8"},"issue":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/8"},"comments":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/statuses/bd8a5bbb7d450f1128b1358b45ac3f7e09f52515"}}}}
{"actor":{"display_login":"martinda"}}