-
Notifications
You must be signed in to change notification settings - Fork 5.5k
bazel: use GCS remote cache #4050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
72f153e
757581c
c297830
ddcc25d
6ec7ebf
e49e7db
58fcfdf
e4f2dd4
9f415e8
2c95de0
7a79526
877957c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| gcp_service_account_cleanup() { | ||
| echo "Deleting service account key file..." | ||
| rm -rf /tmp/gcp_service_account.json | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
| } | ||
|
|
||
| if [[ ! -z "${BAZEL_REMOTE_CACHE}" ]]; then | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: remove superfluous blank lines here and below. |
||
| if [[ ! -z "${GCP_SERVICE_ACCOUNT_KEY}" ]]; then | ||
| echo "${GCP_SERVICE_ACCOUNT_KEY}" | base64 --decode > /tmp/gcp_service_account.json | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| trap gcp_service_account_cleanup EXIT | ||
|
|
||
| export BAZEL_BUILD_EXTRA_OPTIONS="${BAZEL_BUILD_EXTRA_OPTIONS} \ | ||
| --remote_http_cache=${BAZEL_REMOTE_CACHE} --google_credentials=/tmp/gcp_service_account.json" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have to use filesystem? If so, best to make sure that the file perms are appropriately restricted.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, switched to using |
||
| echo "Set up bazel read/write HTTP cache at ${BAZEL_REMOTE_CACHE}." | ||
| else | ||
| export BAZEL_BUILD_EXTRA_OPTIONS="${BAZEL_BUILD_EXTRA_OPTIONS} \ | ||
| --remote_http_cache=${BAZEL_REMOTE_CACHE} --noremote_upload_local_results" | ||
| echo "Set up bazel read only HTTP cache at ${BAZEL_REMOTE_CACHE}." | ||
| fi | ||
|
|
||
| else | ||
| echo "No remote cache bucket is set, skipping setup remote cache." | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be more appropriate to set this in
.circleci/config.yml?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, can we make this end-user configurable and document how individual developers can also make use of it? Maybe in https://github.com/envoyproxy/envoy/blob/master/bazel/README.md.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Specifically for when working outside a Docker image)