Skip to content

Commit

Permalink
feat(bazel/remote-execution): expose exec_properties constant to enab…
Browse files Browse the repository at this point in the history
…le networking on remote

exec platform
  • Loading branch information
kormide authored and devversion committed Sep 16, 2022
1 parent ad5890a commit 4165870
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
21 changes: 11 additions & 10 deletions bazel/remote-execution/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load(":index.bzl", "ENABLE_NETWORK")

package(default_visibility = ["//visibility:public"])

platform(
Expand Down Expand Up @@ -31,23 +33,22 @@ platform(

platform(
name = "platform_with_network",
exec_properties = {
# By default we have network access disabled with the `:platform` target. This is an
# additional platform that extends from the default one but enables network access.
# Network is generally not recommended, but for some exceptions, like integration tests
# running a Yarn install, network access is reasonable. In such special cases, Bazel can
# be invoked to run with this platform. It is recommended that exec platforms with network
# access are used in combination with `--sandbox_default_allow_network=false` as this allows
# specific targets to be granted network access, while others will not have access.
"dockerNetwork": "standard",
},
# By default we have network access disabled with the `:platform` target. This is an
# additional platform that extends from the default one but enables network access.
# Network is generally not recommended, but for some exceptions, like integration tests
# running a Yarn install, network access is reasonable. In such special cases, Bazel can
# be invoked to run with this platform. It is recommended that exec platforms with network
# access are used in combination with `--sandbox_default_allow_network=false` as this allows
# specific targets to be granted network access, while others will not have access.
exec_properties = ENABLE_NETWORK,
parents = [":platform"],
)

filegroup(
name = "files",
srcs = [
"BUILD.bazel",
"index.bzl",
"//bazel/remote-execution/cpp:files",
],
)
3 changes: 3 additions & 0 deletions bazel/remote-execution/index.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Value for exec_properties that can be added to any target to enable
# networking when `:platform` is used, which disables networking by default.
ENABLE_NETWORK = {"dockerNetwork": "standard"}

0 comments on commit 4165870

Please sign in to comment.