{"action":"created","comment":{"url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/comments/205203958","pull_request_review_id":140428205,"id":205203958,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTIwMzk1OA==","diff_hunk":"@@ -99,32 +108,89 @@\n         \"bazel_{}_docker-packages.tar\".format(LATEST_BAZEL_VERSION),\n }\n \n-assert set(supported_types) \\\n+# =========== ENDING HERE ===========\n+assert set(SUPPORTED_TYPES) \\\n         == set(TYPE_PACKAGE_MAP.keys()) \\\n         == set(TYPE_TARGET_MAP.keys()) \\\n         == set(TYPE_TARBALL_MAP.keys()), \\\n             \"TYPES ARE OUT OF SYNC\"\n \n \n-def main(type_, project, container, tag, async_, bucket, local):\n+def main(type_, project, container, tag, async_, bucket, local, bazel_version, map = None):\n   '''Runs the build. More info in module docstring at the top.\n   '''\n+  type_package_map = TYPE_PACKAGE_MAP\n+  type_target_map = TYPE_TARGET_MAP\n+  type_tarball_map = TYPE_TARBALL_MAP\n+\n+  if map: # Override the map values\n+    try:\n+      map_module = imp.load_source(\"map\", map)\n+    except IOError as e:\n+      print(\"Error reading map file.\\n\" ,e)\n+    \n+    try:\n+      type_package_map = map_module.TYPE_PACKAGE_MAP\n+      type_target_map = map_module.TYPE_TARGET_MAP\n+      type_tarball_map = map_module.TYPE_TARBALL_MAP\n+    except AttributeError as e:\n+      print(\"Error getting attributes from map file.\\n\", e)\n+\n+  # Gets the project root (for calling bazel targets)\n   project_root = subprocess.check_output(\n       shlex.split(\"git rev-parse --show-toplevel\")).strip()\n-  package = TYPE_PACKAGE_MAP[type_]\n-  target = TYPE_TARGET_MAP[type_]\n-  tarball = TYPE_TARBALL_MAP[type_]\n-\n+  package = type_package_map[type_]\n+  target = type_target_map[type_]\n+  tarball = None\n+  if bucket:\n+    tarball = type_tarball_map[type_]\n+\n+  # Gets the base directory of the bazel-toolchains repo (relative to project_root)\n+  # This is for referencing yaml files and mounting the project to gcloud.\n+  # Allows the bazel-toolchains repo to be cloned in any subdirectory\n+  # of another project and bazel_toolchains_base_dir will store the relative path\n+  # from the root of that git project to the root of the bazel-toolchains git project.\n+  # Ex. If we are in folder foo and the structure looks like this:\n+  # foo/\n+  #     subdir/\n+  #         bazel-toolchains\n+  #     ...\n+  # \n+  # Then if we call build.py with the terminal running in foo,\n+  # bazel_toolchains_base_dir == \"subdir/bazel-toolchains\"\n+  # (This also allows for renaming of the bazel-toolchains folder as the variable\n+  # will store the path regardless of the directory names) \n+  os.chdir(os.path.dirname(__file__))\n+  bazel_toolchains_base_dir = os.path.relpath(subprocess.check_output(\n+      shlex.split(\"git rev-parse --show-toplevel\")).strip(), project_root)\n+  \n   # We need to start the build from the root of the project, so that we can\n   # mount the full root directory (to use bazel builder properly).\n   os.chdir(project_root)\n-  # We need to run clean to make sure we don't mount local build outputs\n-  subprocess.call([\"bazel\", \"clean\"])\n+\n+  # Ensure all BUILD files under /third_party have the right permission.\n+  # This is because in some systems the BUILD files under /third_party\n+  # (after git clone) will be with permission 640 and the build will\n+  # fail in Container Builder.\n+  for dirpath, _, files in os.walk(\"third_party\"):","path":"container/build.py","position":143,"original_position":143,"commit_id":"5382ad6ff75f88dc1977844198197e05504e1b28","original_commit_id":"5382ad6ff75f88dc1977844198197e05504e1b28","user":{"login":"xingao267","id":10503762,"node_id":"MDQ6VXNlcjEwNTAzNzYy","avatar_url":"https://avatars3.githubusercontent.com/u/10503762?v=4","gravatar_id":"","url":"https://api.github.com/users/xingao267","html_url":"https://github.com/xingao267","followers_url":"https://api.github.com/users/xingao267/followers","following_url":"https://api.github.com/users/xingao267/following{/other_user}","gists_url":"https://api.github.com/users/xingao267/gists{/gist_id}","starred_url":"https://api.github.com/users/xingao267/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xingao267/subscriptions","organizations_url":"https://api.github.com/users/xingao267/orgs","repos_url":"https://api.github.com/users/xingao267/repos","events_url":"https://api.github.com/users/xingao267/events{/privacy}","received_events_url":"https://api.github.com/users/xingao267/received_events","type":"User","site_admin":false},"body":"This should stay in cloud_build function.","created_at":"2018-07-25T17:50:02Z","updated_at":"2018-07-25T17:50:40Z","html_url":"https://github.com/bazelbuild/bazel-toolchains/pull/130#discussion_r205203958","pull_request_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/130","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/comments/205203958"},"html":{"href":"https://github.com/bazelbuild/bazel-toolchains/pull/130#discussion_r205203958"},"pull_request":{"href":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/130"}}},"pull_request":{"url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/130","id":203269435,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzMjY5NDM1","html_url":"https://github.com/bazelbuild/bazel-toolchains/pull/130","diff_url":"https://github.com/bazelbuild/bazel-toolchains/pull/130.diff","patch_url":"https://github.com/bazelbuild/bazel-toolchains/pull/130.patch","issue_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/issues/130","number":130,"state":"open","locked":false,"title":"Improve build.py","user":{"login":"ArthurRab","id":24866049,"node_id":"MDQ6VXNlcjI0ODY2MDQ5","avatar_url":"https://avatars3.githubusercontent.com/u/24866049?v=4","gravatar_id":"","url":"https://api.github.com/users/ArthurRab","html_url":"https://github.com/ArthurRab","followers_url":"https://api.github.com/users/ArthurRab/followers","following_url":"https://api.github.com/users/ArthurRab/following{/other_user}","gists_url":"https://api.github.com/users/ArthurRab/gists{/gist_id}","starred_url":"https://api.github.com/users/ArthurRab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArthurRab/subscriptions","organizations_url":"https://api.github.com/users/ArthurRab/orgs","repos_url":"https://api.github.com/users/ArthurRab/repos","events_url":"https://api.github.com/users/ArthurRab/events{/privacy}","received_events_url":"https://api.github.com/users/ArthurRab/received_events","type":"User","site_admin":false},"body":"Added custom bazel-version selection to build.py\r\n\r\nUpdated yaml configs to support this\r\n\r\nMade target maps overidable in build.py\r\n\r\nMade build.py usable if called from outside directory as long as it is a subdirectory","created_at":"2018-07-23T16:08:41Z","updated_at":"2018-07-25T17:50:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f75d1a5075f1cc3ec7ba45206cc6f879be46b83a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/130/commits","review_comments_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/130/comments","review_comment_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/issues/130/comments","statuses_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/statuses/5382ad6ff75f88dc1977844198197e05504e1b28","head":{"label":"ArthurRab:improve_build_py","ref":"improve_build_py","sha":"5382ad6ff75f88dc1977844198197e05504e1b28","user":{"login":"ArthurRab","id":24866049,"node_id":"MDQ6VXNlcjI0ODY2MDQ5","avatar_url":"https://avatars3.githubusercontent.com/u/24866049?v=4","gravatar_id":"","url":"https://api.github.com/users/ArthurRab","html_url":"https://github.com/ArthurRab","followers_url":"https://api.github.com/users/ArthurRab/followers","following_url":"https://api.github.com/users/ArthurRab/following{/other_user}","gists_url":"https://api.github.com/users/ArthurRab/gists{/gist_id}","starred_url":"https://api.github.com/users/ArthurRab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArthurRab/subscriptions","organizations_url":"https://api.github.com/users/ArthurRab/orgs","repos_url":"https://api.github.com/users/ArthurRab/repos","events_url":"https://api.github.com/users/ArthurRab/events{/privacy}","received_events_url":"https://api.github.com/users/ArthurRab/received_events","type":"User","site_admin":false},"repo":{"id":137927088,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc5MjcwODg=","name":"bazel-toolchains","full_name":"ArthurRab/bazel-toolchains","owner":{"login":"ArthurRab","id":24866049,"node_id":"MDQ6VXNlcjI0ODY2MDQ5","avatar_url":"https://avatars3.githubusercontent.com/u/24866049?v=4","gravatar_id":"","url":"https://api.github.com/users/ArthurRab","html_url":"https://github.com/ArthurRab","followers_url":"https://api.github.com/users/ArthurRab/followers","following_url":"https://api.github.com/users/ArthurRab/following{/other_user}","gists_url":"https://api.github.com/users/ArthurRab/gists{/gist_id}","starred_url":"https://api.github.com/users/ArthurRab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArthurRab/subscriptions","organizations_url":"https://api.github.com/users/ArthurRab/orgs","repos_url":"https://api.github.com/users/ArthurRab/repos","events_url":"https://api.github.com/users/ArthurRab/events{/privacy}","received_events_url":"https://api.github.com/users/ArthurRab/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ArthurRab/bazel-toolchains","description":null,"fork":true,"url":"https://api.github.com/repos/ArthurRab/bazel-toolchains","forks_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/forks","keys_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/teams","hooks_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/hooks","issue_events_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/issues/events{/number}","events_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/events","assignees_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/assignees{/user}","branches_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/branches{/branch}","tags_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/tags","blobs_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/git/refs{/sha}","trees_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/statuses/{sha}","languages_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/languages","stargazers_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/stargazers","contributors_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/contributors","subscribers_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/subscribers","subscription_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/subscription","commits_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/commits{/sha}","git_commits_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/git/commits{/sha}","comments_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/comments{/number}","issue_comment_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/issues/comments{/number}","contents_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/contents/{+path}","compare_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/merges","archive_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/downloads","issues_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/issues{/number}","pulls_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/pulls{/number}","milestones_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/milestones{/number}","notifications_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/labels{/name}","releases_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/releases{/id}","deployments_url":"https://api.github.com/repos/ArthurRab/bazel-toolchains/deployments","created_at":"2018-06-19T17:58:24Z","updated_at":"2018-07-24T19:47:46Z","pushed_at":"2018-07-25T17:38:09Z","git_url":"git://github.com/ArthurRab/bazel-toolchains.git","ssh_url":"git@github.com:ArthurRab/bazel-toolchains.git","clone_url":"https://github.com/ArthurRab/bazel-toolchains.git","svn_url":"https://github.com/ArthurRab/bazel-toolchains","homepage":null,"size":476,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bazelbuild:master","ref":"master","sha":"88a13772518eec467a3e841bc199fc399e640f1d","user":{"login":"bazelbuild","id":11684617,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNjg0NjE3","avatar_url":"https://avatars1.githubusercontent.com/u/11684617?v=4","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"repo":{"id":95790423,"node_id":"MDEwOlJlcG9zaXRvcnk5NTc5MDQyMw==","name":"bazel-toolchains","full_name":"bazelbuild/bazel-toolchains","owner":{"login":"bazelbuild","id":11684617,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNjg0NjE3","avatar_url":"https://avatars1.githubusercontent.com/u/11684617?v=4","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bazelbuild/bazel-toolchains","description":null,"fork":false,"url":"https://api.github.com/repos/bazelbuild/bazel-toolchains","forks_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/forks","keys_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/teams","hooks_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/hooks","issue_events_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/issues/events{/number}","events_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/events","assignees_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/assignees{/user}","branches_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/branches{/branch}","tags_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/tags","blobs_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/git/refs{/sha}","trees_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/statuses/{sha}","languages_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/languages","stargazers_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/stargazers","contributors_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/contributors","subscribers_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/subscribers","subscription_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/subscription","commits_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/commits{/sha}","git_commits_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/git/commits{/sha}","comments_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/comments{/number}","issue_comment_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/issues/comments{/number}","contents_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/contents/{+path}","compare_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/merges","archive_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/downloads","issues_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/issues{/number}","pulls_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls{/number}","milestones_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/milestones{/number}","notifications_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/labels{/name}","releases_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/releases{/id}","deployments_url":"https://api.github.com/repos/bazelbuild/bazel-toolchains/deployments","created_at":"2017-06-29T15:13:48Z","updated_at":"2018-07-25T17:28:33Z","pushed_at":"2018-07-25T17:38:10Z","git_url":"git://github.com/bazelbuild/bazel-toolchains.git","ssh_url":"git@github.com:bazelbuild/bazel-toolchains.git","clone_url":"https://github.com/bazelbuild/bazel-toolchains.git","svn_url":"https://github.com/bazelbuild/bazel-toolchains","homepage":null,"size":424,"stargazers_count":18,"watchers_count":18,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":21,"open_issues":3,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/130"},"html":{"href":"https://github.com/bazelbuild/bazel-toolchains/pull/130"},"issue":{"href":"https://api.github.com/repos/bazelbuild/bazel-toolchains/issues/130"},"comments":{"href":"https://api.github.com/repos/bazelbuild/bazel-toolchains/issues/130/comments"},"review_comments":{"href":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/130/comments"},"review_comment":{"href":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bazelbuild/bazel-toolchains/pulls/130/commits"},"statuses":{"href":"https://api.github.com/repos/bazelbuild/bazel-toolchains/statuses/5382ad6ff75f88dc1977844198197e05504e1b28"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"xingao267"}}