{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/comments/103543881","pull_request_review_id":24333887,"id":103543881,"diff_hunk":"@@ -0,0 +1,81 @@\n+## RFC: [JENKINS-41118](https://issues.jenkins-ci.org/browse/JENKINS-41118) - custom workspaces in Declarative\n+\n+* Author: Andrew Bayer\n+* Created Date: February 23, 2017\n+* Approved Date: n/a\n+* JIRA: [JENKINS-41118](https://issues.jenkins-ci.org/browse/JENKINS-41118)\n+* Status: Draft\n+\n+### Problem Statement\n+\n+As described in the ticket, there are multiple reasons why one \n+may want to use a hardcoded workspace directory under\n+`$JENKINS_HOME/workspace` for a Pipeline, such as reusing the\n+same checkout of a very large repository, or guaranteeing a\n+certain full directory layout to make Golang happy, etc. This\n+may be needed both at the top level and per-stage, so that\n+individual stages could have a custom workspace when they had\n+their own agent configuration as well.\n+\n+### Runtime Implementation\n+\n+The actual runtime implementation is very clear - if a custom\n+workspace is specified, then immediately after entering the\n+relevant `node` block and before doing a `checkout scm`, we\n+would enter a `ws('some-dir')` block. \n+\n+### Syntax\n+\n+#### Option Name\n+\n+Regardless of where the option ends up living in the syntax, I\n+propose that it be named `customWorkspace`. This maps to the\n+Freestyle \"Custom Workspace\" option, which is analogous to the\n+behavior of the `ws(...)` step (though not exactly, since\n+\"Custom Workspace\" is an absolute path while `ws(...)` is\n+relative to the workspace root on the agent).\n+\n+#### Where the Option is Specified\n+\n+The easiest place to add this option so that it would be\n+available for use anywhere an `agent` could be specified would\n+be in the `agent` itself, as an additional option on relevant\n+`DeclarativeAgent` types. That would currently mean `label`,\n+`docker`, and `dockerfile` - `any` is a special alias for\n+`label ''` and can't be modified, and this would not be\n+relevant for `none`. \n+\n+For `docker` and `dockerfile`, adding an additional option is \n+trivial, given that they already have additional options for \n+`args` etc. But for `label`, this would be the first additional \n+option and so would create the first case of specifying `label` \n+with a block. However, the block form of `label` actually works \n+currently - `label 'something'` is in fact just a shortcut for \n+`label { label 'something' }` behind the scenes.\n+\n+#### Alternatives\n+\n+Perhaps the best alternative to `agent` configuration would be \n+to have the custom workspace specified as a top-level and \n+per-stage option. This would require adding an `options` \n+section for `stage`, since we don't have anywhere for options \n+to be configured per-stage currently. \n+\n+#### Examples\n+\n+```groovy\n+agent {\n+    label {\n+        label \"some-label\" // This could be changed to something other than \"label\"","path":"rfc/JENKINS-41118-custom-workspaces.md","position":69,"original_position":69,"commit_id":"569323f1194fdfe4573248da853bb6f97ba85aee","original_commit_id":"4f5a1d702e7c79996e68fee59c624e943d91ab61","user":{"login":"kzantow","id":3009477,"avatar_url":"https://avatars1.githubusercontent.com/u/3009477?v=3","gravatar_id":"","url":"https://api.github.com/users/kzantow","html_url":"https://github.com/kzantow","followers_url":"https://api.github.com/users/kzantow/followers","following_url":"https://api.github.com/users/kzantow/following{/other_user}","gists_url":"https://api.github.com/users/kzantow/gists{/gist_id}","starred_url":"https://api.github.com/users/kzantow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzantow/subscriptions","organizations_url":"https://api.github.com/users/kzantow/orgs","repos_url":"https://api.github.com/users/kzantow/repos","events_url":"https://api.github.com/users/kzantow/events{/privacy}","received_events_url":"https://api.github.com/users/kzantow/received_events","type":"User","site_admin":false},"body":"I mean, we can add custom editors for this stuff, but it seems like just specifying this as an overall agent option as i've described would be the easiest for both end users and solve the issue of adding random types just so we don't have `label` twice...","created_at":"2017-02-28T20:25:13Z","updated_at":"2017-02-28T20:25:13Z","html_url":"https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/123#discussion_r103543881","pull_request_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/123","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/comments/103543881"},"html":{"href":"https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/123#discussion_r103543881"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/123"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/123","id":107528355,"html_url":"https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/123","diff_url":"https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/123.diff","patch_url":"https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/123.patch","issue_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/issues/123","number":123,"state":"open","locked":false,"title":"[JENKINS-41118] Allow specifying top level ws(...) block","user":{"login":"abayer","id":120218,"avatar_url":"https://avatars1.githubusercontent.com/u/120218?v=3","gravatar_id":"","url":"https://api.github.com/users/abayer","html_url":"https://github.com/abayer","followers_url":"https://api.github.com/users/abayer/followers","following_url":"https://api.github.com/users/abayer/following{/other_user}","gists_url":"https://api.github.com/users/abayer/gists{/gist_id}","starred_url":"https://api.github.com/users/abayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abayer/subscriptions","organizations_url":"https://api.github.com/users/abayer/orgs","repos_url":"https://api.github.com/users/abayer/repos","events_url":"https://api.github.com/users/abayer/events{/privacy}","received_events_url":"https://api.github.com/users/abayer/received_events","type":"User","site_admin":false},"body":"* JENKINS issue(s):\r\n    * [JENKINS-41118](https://issues.jenkins-ci.org/browse/JENKINS-41118)\r\n* Description:\r\n    * Enables custom workspaces in Declarative as an `agent` option.\r\n* RFC document:\r\n    * https://github.com/abayer/pipeline-model-definition-plugin/blob/jenkins-41118/rfc/JENKINS-41118-custom-workspaces.md\r\n* Documentation changes:\r\n    * Doc update will be needed for the new `customWorkspace` option for `label`, `docker` and `dockerfile`.\r\n* Users/aliases to notify:\r\n    * @reviewbybees \r\n    * @rsandell \r\n","created_at":"2017-02-23T00:07:14Z","updated_at":"2017-02-28T20:25:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f100ad360168a59724cb46bcfacbb7df52731057","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/milestones/1","html_url":"https://github.com/jenkinsci/pipeline-model-definition-plugin/milestone/1","labels_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/milestones/1/labels","id":2275010,"number":1,"title":"1.1","description":"Work targeted at 1.1","creator":{"login":"abayer","id":120218,"avatar_url":"https://avatars1.githubusercontent.com/u/120218?v=3","gravatar_id":"","url":"https://api.github.com/users/abayer","html_url":"https://github.com/abayer","followers_url":"https://api.github.com/users/abayer/followers","following_url":"https://api.github.com/users/abayer/following{/other_user}","gists_url":"https://api.github.com/users/abayer/gists{/gist_id}","starred_url":"https://api.github.com/users/abayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abayer/subscriptions","organizations_url":"https://api.github.com/users/abayer/orgs","repos_url":"https://api.github.com/users/abayer/repos","events_url":"https://api.github.com/users/abayer/events{/privacy}","received_events_url":"https://api.github.com/users/abayer/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":5,"state":"open","created_at":"2017-01-24T16:38:53Z","updated_at":"2017-02-27T19:29:10Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/123/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/123/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/issues/123/comments","statuses_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/statuses/569323f1194fdfe4573248da853bb6f97ba85aee","head":{"label":"abayer:jenkins-41118","ref":"jenkins-41118","sha":"569323f1194fdfe4573248da853bb6f97ba85aee","user":{"login":"abayer","id":120218,"avatar_url":"https://avatars1.githubusercontent.com/u/120218?v=3","gravatar_id":"","url":"https://api.github.com/users/abayer","html_url":"https://github.com/abayer","followers_url":"https://api.github.com/users/abayer/followers","following_url":"https://api.github.com/users/abayer/following{/other_user}","gists_url":"https://api.github.com/users/abayer/gists{/gist_id}","starred_url":"https://api.github.com/users/abayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abayer/subscriptions","organizations_url":"https://api.github.com/users/abayer/orgs","repos_url":"https://api.github.com/users/abayer/repos","events_url":"https://api.github.com/users/abayer/events{/privacy}","received_events_url":"https://api.github.com/users/abayer/received_events","type":"User","site_admin":false},"repo":{"id":66791984,"name":"pipeline-model-definition-plugin","full_name":"abayer/pipeline-model-definition-plugin","owner":{"login":"abayer","id":120218,"avatar_url":"https://avatars1.githubusercontent.com/u/120218?v=3","gravatar_id":"","url":"https://api.github.com/users/abayer","html_url":"https://github.com/abayer","followers_url":"https://api.github.com/users/abayer/followers","following_url":"https://api.github.com/users/abayer/following{/other_user}","gists_url":"https://api.github.com/users/abayer/gists{/gist_id}","starred_url":"https://api.github.com/users/abayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abayer/subscriptions","organizations_url":"https://api.github.com/users/abayer/orgs","repos_url":"https://api.github.com/users/abayer/repos","events_url":"https://api.github.com/users/abayer/events{/privacy}","received_events_url":"https://api.github.com/users/abayer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abayer/pipeline-model-definition-plugin","description":null,"fork":true,"url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin","forks_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/forks","keys_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/teams","hooks_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/hooks","issue_events_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/events","assignees_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/tags","blobs_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/languages","stargazers_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/stargazers","contributors_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/contributors","subscribers_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/subscribers","subscription_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/subscription","commits_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/merges","archive_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/downloads","issues_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/labels{/name}","releases_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/abayer/pipeline-model-definition-plugin/deployments","created_at":"2016-08-28T21:35:16Z","updated_at":"2016-12-14T16:40:34Z","pushed_at":"2017-02-28T19:30:13Z","git_url":"git://github.com/abayer/pipeline-model-definition-plugin.git","ssh_url":"git@github.com:abayer/pipeline-model-definition-plugin.git","clone_url":"https://github.com/abayer/pipeline-model-definition-plugin.git","svn_url":"https://github.com/abayer/pipeline-model-definition-plugin","homepage":"","size":1692,"stargazers_count":2,"watchers_count":2,"language":"Groovy","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":2,"default_branch":"master"}},"base":{"label":"jenkinsci:master","ref":"master","sha":"c40dd713c51b3140ce53db3552cf9a90e39628cd","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars3.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":66677338,"name":"pipeline-model-definition-plugin","full_name":"jenkinsci/pipeline-model-definition-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars3.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/pipeline-model-definition-plugin","description":null,"fork":false,"url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin","forks_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/deployments","created_at":"2016-08-26T20:28:39Z","updated_at":"2017-02-22T10:12:27Z","pushed_at":"2017-02-28T19:30:14Z","git_url":"git://github.com/jenkinsci/pipeline-model-definition-plugin.git","ssh_url":"git@github.com:jenkinsci/pipeline-model-definition-plugin.git","clone_url":"https://github.com/jenkinsci/pipeline-model-definition-plugin.git","svn_url":"https://github.com/jenkinsci/pipeline-model-definition-plugin","homepage":"","size":1490,"stargazers_count":86,"watchers_count":86,"language":"Groovy","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":7,"forks":32,"open_issues":7,"watchers":86,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/123"},"html":{"href":"https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/123"},"issue":{"href":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/issues/123"},"comments":{"href":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/issues/123/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/123/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/pulls/123/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/pipeline-model-definition-plugin/statuses/569323f1194fdfe4573248da853bb6f97ba85aee"}}}}
{"actor":{"display_login":"kzantow"}}