Skip to content

Commit

Permalink
build: introduce remote bazel caching (angular#27358)
Browse files Browse the repository at this point in the history
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 angular#27358
  • Loading branch information
mgechev authored and IgorMinar committed Dec 6, 2018
1 parent d63d53f commit 7f221d8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -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 #
###############################
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ yarn-error.log

# rollup-test output
/modules/rollup-test/dist/

# User specific bazel settings
.bazelrc.user

19 changes: 17 additions & 2 deletions docs/BAZEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7f221d8

Please sign in to comment.