{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/27507245","id":27507245,"diff_hunk":"@@ -308,7 +311,14 @@ func (b *Builder) dispatch(stepN int, ast *parser.Node) error {\n \t\tstr = ast.Value\n \t\tif _, ok := replaceEnvAllowed[cmd]; ok {\n \t\t\tvar err error\n-\t\t\tstr, err = ProcessWord(ast.Value, b.Config.Env)\n+\t\t\t// Append the build-time environment to config-environment.\n+\t\t\t// This allows builder config to override the variables, making the behavior similar to\n+\t\t\t// a shell script i.e. `ENV foo bar` overrides value of `foo` passed in build\n+\t\t\t// context. But `ENV foo $foo` will use the value from build context if one\n+\t\t\t// isn't already been defined by a previous ENV primitive.\n+\t\t\tenvs := b.Config.Env","path":"builder/evaluator.go","position":20,"original_position":20,"commit_id":"7af13a497e1f4ea0ac77aeb480b56a2bc9aefbcb","original_commit_id":"7af13a497e1f4ea0ac77aeb480b56a2bc9aefbcb","user":{"login":"duglin","id":1944671,"avatar_url":"https://avatars.githubusercontent.com/u/1944671?v=3","gravatar_id":"","url":"https://api.github.com/users/duglin","html_url":"https://github.com/duglin","followers_url":"https://api.github.com/users/duglin/followers","following_url":"https://api.github.com/users/duglin/following{/other_user}","gists_url":"https://api.github.com/users/duglin/gists{/gist_id}","starred_url":"https://api.github.com/users/duglin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duglin/subscriptions","organizations_url":"https://api.github.com/users/duglin/orgs","repos_url":"https://api.github.com/users/duglin/repos","events_url":"https://api.github.com/users/duglin/events{/privacy}","received_events_url":"https://api.github.com/users/duglin/received_events","type":"User","site_admin":false},"body":"Just as an optimization, can we check to see if its safe to move these two\r\n`envs =...` lines to before the for loop (line 305). Then we only do the `append()`\r\nonce and not for each ast node.  I think this is safe because we're not\r\nrecursive within one dockerfile command.  But hopefully our testing will let\r\nuse know for sure.","created_at":"2015-03-31T18:20:55Z","updated_at":"2015-03-31T18:20:55Z","html_url":"https://github.com/docker/docker/pull/9176#discussion_r27507245","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/9176","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/27507245"},"html":{"href":"https://github.com/docker/docker/pull/9176#discussion_r27507245"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/9176"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/9176","id":24466071,"html_url":"https://github.com/docker/docker/pull/9176","diff_url":"https://github.com/docker/docker/pull/9176.diff","patch_url":"https://github.com/docker/docker/pull/9176.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/9176","number":9176,"state":"open","locked":false,"title":"Proposal: Add support for build-time environment variables to the 'build' API","user":{"login":"mapuri","id":9538438,"avatar_url":"https://avatars.githubusercontent.com/u/9538438?v=3","gravatar_id":"","url":"https://api.github.com/users/mapuri","html_url":"https://github.com/mapuri","followers_url":"https://api.github.com/users/mapuri/followers","following_url":"https://api.github.com/users/mapuri/following{/other_user}","gists_url":"https://api.github.com/users/mapuri/gists{/gist_id}","starred_url":"https://api.github.com/users/mapuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapuri/subscriptions","organizations_url":"https://api.github.com/users/mapuri/orgs","repos_url":"https://api.github.com/users/mapuri/repos","events_url":"https://api.github.com/users/mapuri/events{/privacy}","received_events_url":"https://api.github.com/users/mapuri/received_events","type":"User","site_admin":false},"body":"A build-time environment variable gets used only while processing the 'RUN' primitive of a DockerFile. Such a variable is only accessible during 'RUN' and is 'not' persisted with the intermediate and final docker images, thereby addressing the portability concerns of the images generated with 'build'.\r\n\r\nThis addresses issue #4962","created_at":"2014-11-14T19:55:24Z","updated_at":"2015-03-31T18:20:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fdd80c5728125cef60c798b479869908a0f29e70","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/9176/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/9176/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/9176/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/7af13a497e1f4ea0ac77aeb480b56a2bc9aefbcb","head":{"label":"mapuri:master","ref":"master","sha":"7af13a497e1f4ea0ac77aeb480b56a2bc9aefbcb","user":{"login":"mapuri","id":9538438,"avatar_url":"https://avatars.githubusercontent.com/u/9538438?v=3","gravatar_id":"","url":"https://api.github.com/users/mapuri","html_url":"https://github.com/mapuri","followers_url":"https://api.github.com/users/mapuri/followers","following_url":"https://api.github.com/users/mapuri/following{/other_user}","gists_url":"https://api.github.com/users/mapuri/gists{/gist_id}","starred_url":"https://api.github.com/users/mapuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapuri/subscriptions","organizations_url":"https://api.github.com/users/mapuri/orgs","repos_url":"https://api.github.com/users/mapuri/repos","events_url":"https://api.github.com/users/mapuri/events{/privacy}","received_events_url":"https://api.github.com/users/mapuri/received_events","type":"User","site_admin":false},"repo":{"id":26605164,"name":"docker","full_name":"mapuri/docker","owner":{"login":"mapuri","id":9538438,"avatar_url":"https://avatars.githubusercontent.com/u/9538438?v=3","gravatar_id":"","url":"https://api.github.com/users/mapuri","html_url":"https://github.com/mapuri","followers_url":"https://api.github.com/users/mapuri/followers","following_url":"https://api.github.com/users/mapuri/following{/other_user}","gists_url":"https://api.github.com/users/mapuri/gists{/gist_id}","starred_url":"https://api.github.com/users/mapuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapuri/subscriptions","organizations_url":"https://api.github.com/users/mapuri/orgs","repos_url":"https://api.github.com/users/mapuri/repos","events_url":"https://api.github.com/users/mapuri/events{/privacy}","received_events_url":"https://api.github.com/users/mapuri/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mapuri/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/mapuri/docker","forks_url":"https://api.github.com/repos/mapuri/docker/forks","keys_url":"https://api.github.com/repos/mapuri/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapuri/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapuri/docker/teams","hooks_url":"https://api.github.com/repos/mapuri/docker/hooks","issue_events_url":"https://api.github.com/repos/mapuri/docker/issues/events{/number}","events_url":"https://api.github.com/repos/mapuri/docker/events","assignees_url":"https://api.github.com/repos/mapuri/docker/assignees{/user}","branches_url":"https://api.github.com/repos/mapuri/docker/branches{/branch}","tags_url":"https://api.github.com/repos/mapuri/docker/tags","blobs_url":"https://api.github.com/repos/mapuri/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapuri/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapuri/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapuri/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapuri/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/mapuri/docker/languages","stargazers_url":"https://api.github.com/repos/mapuri/docker/stargazers","contributors_url":"https://api.github.com/repos/mapuri/docker/contributors","subscribers_url":"https://api.github.com/repos/mapuri/docker/subscribers","subscription_url":"https://api.github.com/repos/mapuri/docker/subscription","commits_url":"https://api.github.com/repos/mapuri/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapuri/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapuri/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapuri/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapuri/docker/contents/{+path}","compare_url":"https://api.github.com/repos/mapuri/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapuri/docker/merges","archive_url":"https://api.github.com/repos/mapuri/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapuri/docker/downloads","issues_url":"https://api.github.com/repos/mapuri/docker/issues{/number}","pulls_url":"https://api.github.com/repos/mapuri/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/mapuri/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/mapuri/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapuri/docker/labels{/name}","releases_url":"https://api.github.com/repos/mapuri/docker/releases{/id}","created_at":"2014-11-13T19:55:02Z","updated_at":"2015-03-25T21:37:40Z","pushed_at":"2015-03-25T21:37:37Z","git_url":"git://github.com/mapuri/docker.git","ssh_url":"git@github.com:mapuri/docker.git","clone_url":"https://github.com/mapuri/docker.git","svn_url":"https://github.com/mapuri/docker","homepage":"http://www.docker.com","size":46670,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"docker:master","ref":"master","sha":"3d9cbf0e7176e8aa5d4078cd00a400e1dcc5169d","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","created_at":"2013-01-18T18:10:57Z","updated_at":"2015-03-31T17:41:59Z","pushed_at":"2015-03-31T17:49:50Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":162332,"stargazers_count":20427,"watchers_count":20427,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4568,"mirror_url":null,"open_issues_count":875,"forks":4568,"open_issues":875,"watchers":20427,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/9176"},"html":{"href":"https://github.com/docker/docker/pull/9176"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/9176"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/9176/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/9176/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/9176/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/7af13a497e1f4ea0ac77aeb480b56a2bc9aefbcb"}}}}