build: introduce remote bazel caching (#27358)

This PR introduces:

1. Google Cloud Store bucket which contains build artifacts
2. Documentation on how to enable remote caching in development

Each team member should download a service key. More convenient ways of authentication would be more obscure and prevent us from doing identity tracking of the produced artifacts.

PR Close #27358
This commit is contained in:
Minko Gechev 2018-11-28 15:34:27 -08:00 committed by Igor Minar
parent d63d53f5ad
commit 7f221d8d2a
3 changed files with 29 additions and 2 deletions

View File

@ -1,3 +1,11 @@
# Load any settings specific to the current user
try-import .bazelrc.user
################################
# Settings for Angular team members only
################################
# To enable this feature check the "Remote caching" section in docs/BAZEL.md.
build:angular-team --remote_http_cache=https://storage.googleapis.com/angular-team-cache
###############################
# Typescript / Angular / Sass #
###############################

4
.gitignore vendored
View File

@ -30,3 +30,7 @@ yarn-error.log
# rollup-test output
/modules/rollup-test/dist/
# User specific bazel settings
.bazelrc.user

View File

@ -165,8 +165,23 @@ Of course, non-hermeticity in an action can cause problems.
At worst, you can fetch a broken artifact from the cache, making your build non-reproducible.
For this reason, we are careful to implement our Bazel rules to depend only on their inputs.
Currently we only use remote caching on CircleCI.
We could enable it for developer builds as well, which would make initial builds much faster for developers by fetching already-built artifacts from the cache.
Currently we only use remote caching on CircleCI and we let Angular core developers enable remote caching to speed up their builds.
### Remote cache in development
To enable remote caching for your build:
1. Go to the service accounts for the ["internal" project](https://console.cloud.google.com/iam-admin/serviceaccounts?project=internal-200822)
1. Select "Angular local dev", click on "Edit", scroll to the bottom, and click "Create key"
1. When the pop-up shows, select "JSON" for "Key type" and click "Create"
1. Save the key in a secure location
1. Create a file called `.bazelrc.user` in the root directory of the workspace, and add the following content:
```
build --config=angular-team --google_credentials=[ABSOLUTE_PATH_TO_SERVICE_KEY]
```
### Remote cache for Circle CI
This feature is experimental, and developed by the CircleCI team with guidance from Angular.
Contact Alex Eagle with questions.