From d7e9f85ba7d2eeb4da938f6fe8ce1e5c8ed83e83 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Mon, 24 Jun 2019 11:41:18 -0700 Subject: [PATCH] build: setup RBE caching and remote build event service on CI --- .circleci/base-rbe-bazelrc | 5 +++++ .circleci/bazel.rc | 7 +++---- scripts/circleci/bazel/setup-remote-execution.sh | 9 ++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.circleci/base-rbe-bazelrc b/.circleci/base-rbe-bazelrc index 24a24ef1ff22..3e48f629532f 100644 --- a/.circleci/base-rbe-bazelrc +++ b/.circleci/base-rbe-bazelrc @@ -12,6 +12,11 @@ build:remote --remote_executor=remotebuildexecution.googleapis.com build:remote --tls_enabled=true build:remote --auth_enabled=true +# Setup Build Event Service +build:remote --bes_backend=buildeventservice.googleapis.com +build:remote --bes_timeout=30s +build:remote --bes_results_url="https://source.cloud.google.com/results/invocations/" + # Setup the toolchain and platform for the remote build execution. The platform # is automatically configured by the "rbe_autoconfig" rule in the project workpsace. build:remote --crosstool_top=@rbe_default//cc:toolchain diff --git a/.circleci/bazel.rc b/.circleci/bazel.rc index 4e3e73a1b86f..e09d3ebaa7fa 100644 --- a/.circleci/bazel.rc +++ b/.circleci/bazel.rc @@ -15,8 +15,7 @@ import %workspace%/.circleci/base-rbe-bazelrc # Use the Angular team internal GCP instance for remote execution. build:remote --remote_instance_name=projects/internal-200822/instances/default_instance +build:remote --project_id=internal-200822 -# We want to accept remote cached build artifacts to speed up our builds incrementally. -# TODO(devversion): Temporary disabled since we don't have much insight on possible security -# issues. Enable this once we investigated this further and talked to the RBE team. -build:remote --remote_accept_cached=false +# Always read from remote cache on CI. +build:remote --remote_accept_cached=true diff --git a/scripts/circleci/bazel/setup-remote-execution.sh b/scripts/circleci/bazel/setup-remote-execution.sh index b1e366ac4191..7f3a1934cea1 100755 --- a/scripts/circleci/bazel/setup-remote-execution.sh +++ b/scripts/circleci/bazel/setup-remote-execution.sh @@ -16,4 +16,11 @@ openssl aes-256-cbc -d -in .circleci/gcp_token -md md5 -k ${GCP_DECRYPT_TOKEN} \ echo "export GOOGLE_APPLICATION_CREDENTIALS=/home/.gcp_credentials" >> $BASH_ENV # Update the CircleCI Bazel configuration to always use remote execution. -echo 'build --config=remote' >> .circleci/bazel.rc +echo "build --config=remote" >> .circleci/bazel.rc + +# Only upload locally built results to the cache if we are running already commited code. +if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then + echo "build --remote_upload_local_results=false" >> .circleci/bazel.rc +else + echo "build --remote_upload_local_results=true" >> .circleci/bazel.rc +fi