Skip to content

Commit

Permalink
feat(bazel): use new rbe_autoconfig() and new container.
Browse files Browse the repository at this point in the history
  • Loading branch information
xingao267 committed Mar 25, 2019
1 parent c34c223 commit 13d213e
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 162 deletions.
47 changes: 38 additions & 9 deletions .bazelrc
Expand Up @@ -115,23 +115,52 @@ build --define=compile=legacy
# --config=remote
###############################

# Load default settings for Remote Build Execution
# When updating, the URLs of bazel_toolchains in packages/bazel/package.bzl
# may also need to be updated (see https://github.com/angular/angular/pull/27935)
import %workspace%/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/bazel-0.21.0.bazelrc

# Increase the default number of jobs by 50% because our build has lots of
# parallelism
build:remote --jobs=150

# Point to our custom execution platform; see tools/BUILD.bazel
build:remote --extra_execution_platforms=//tools:rbe_ubuntu1604-angular
build:remote --host_platform=//tools:rbe_ubuntu1604-angular
build:remote --platforms=//tools:rbe_ubuntu1604-angular
# Toolchain and platform related flags
build:remote --host_javabase=@rbe_ubuntu1604_angular//java:jdk
build:remote --javabase=@rbe_ubuntu1604_angular//java:jdk
build:remote --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:remote --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:remote --crosstool_top=@rbe_ubuntu1604_angular//cc:toolchain
build:remote --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
build:remote --extra_toolchains=@rbe_ubuntu1604_angular//config:cc-toolchain
build:remote --extra_execution_platforms=//tools:platform
build:remote --host_platform=//tools:platform
build:remote --platforms=//tools:platform

# Set various strategies so that all actions execute remotely. Mixing remote
# and local execution will lead to errors unless the toolchain and remote
# machine exactly match the host machine.
build:remote --spawn_strategy=remote
build:remote --strategy=Javac=remote
build:remote --strategy=Closure=remote
build:remote --strategy=Genrule=remote
build:remote --define=EXECUTOR=remote

# Enable the remote cache so action results can be shared across machines,
# developers, and workspaces.
build:remote --remote_cache=remotebuildexecution.googleapis.com

# Enable remote execution so actions are performed on the remote systems.
build:remote --remote_executor=remotebuildexecution.googleapis.com

# Remote instance.
build:remote --remote_instance_name=projects/internal-200822/instances/default_instance

# Enable encryption.
build:remote --tls_enabled=true

# Set a higher timeout value, just in case.
build:remote --remote_timeout=3600

# Enable authentication. This will pick up application default credentials by
# default. You can use --auth_credentials=some_file.json to use a service
# account credential instead.
build:remote --auth_enabled=true

# Do not accept remote cache.
# We need to understand the security risks of using prior build artifacts.
build:remote --remote_accept_cached=false
Expand Down
3 changes: 2 additions & 1 deletion .circleci/config.yml
Expand Up @@ -167,7 +167,8 @@ jobs:
- *attach_workspace
- *init_environment
- *setup_circleci_bazel_config

# Enable remote/sibling docker which is needed by auto-selection of toolchain configs for RBE.
- setup_remote_docker
# Setup remote execution and run RBE-compatible tests.
- *setup_bazel_remote_execution
- run: yarn bazel test //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local
Expand Down
14 changes: 14 additions & 0 deletions WORKSPACE
Expand Up @@ -119,3 +119,17 @@ sass_repositories()
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")

skydoc_repositories()

load("@bazel_toolchains//rules:environments.bzl", "clang_env")
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")

rbe_autoconfig(
name = "rbe_ubuntu1604_angular",
base_container_digest = "sha256:69c9f1652941d64a46f6f7358a44c1718f25caa5cb1ced4a58ccc5281cd183b5",
digest = "sha256:ce383089ba3fc1f6f687fc1e492401e21594c91d9587a315e26e7d6c91aafc4f",
env = clang_env(),
registry = "marketplace.gcr.io",
repository = "google/rbe-ubuntu16-04-webtest",
# To remove.
use_checked_in_confs = False,
)
7 changes: 3 additions & 4 deletions packages/bazel/package.bzl
Expand Up @@ -35,11 +35,10 @@ def rules_angular_dev_dependencies():
_maybe(
http_archive,
name = "bazel_toolchains",
sha256 = "ee854b5de299138c1f4a2edb5573d22b21d975acfc7aa938f36d30b49ef97498",
strip_prefix = "bazel-toolchains-37419a124bdb9af2fec5b99a973d359b6b899b61",
sha256 = "9aa113ad4e0843ea9155fc77d9ebe10fb8a6e2b26bb881dafe4aeec215aa7d6a",
strip_prefix = "bazel-toolchains-a6edc1ee16daeb37e4b005db951622df8f882a06",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/37419a124bdb9af2fec5b99a973d359b6b899b61.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/archive/37419a124bdb9af2fec5b99a973d359b6b899b61.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/archive/a6edc1ee16daeb37e4b005db951622df8f882a06.tar.gz",
],
)

Expand Down

This file was deleted.

24 changes: 3 additions & 21 deletions tools/BUILD.bazel
Expand Up @@ -13,29 +13,11 @@ ts_config(
deps = ["tsconfig.json"],
)

# The toolchain container used for execution is defined in the target indicated
# by "extra_execution_platforms", "host_platform" and "platforms".
# If you are using your own toolchain container, you need to create a platform
# target with "constraint_values" that allow for the toolchain specified with
# "extra_toolchains" to be selected (given constraints defined in
# "exec_compatible_with").
# More about platforms: https://docs.bazel.build/versions/master/platforms.html
platform(
name = "rbe_ubuntu1604-angular",
constraint_values = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:linux",
"@bazel_tools//tools/cpp:clang",
"@bazel_toolchains//constraints:xenial",
],
# We are currently using the docker container image provided by RBE. Once
# Angular has the billing account setup, we should start using/maintaining
# our own docker container image.
name = "platform",
parents = ["@rbe_ubuntu1604_angular//config:platform"],
remote_execution_properties = """
properties: {
name: "container-image"
value:"docker://gcr.io/asci-toolchain/nosla-ubuntu16_04-webtest@sha256:e874885f5e3d9ac0c0d3176e5369cb5969467dbf9ad8d42b862829cec8d84b9b"
}
{PARENT_REMOTE_EXECUTION_PROPERTIES}
properties: {
name: "dockerAddCapabilities"
value: "SYS_ADMIN"
Expand Down

0 comments on commit 13d213e

Please sign in to comment.