Skip to content

Commit fbaffc8

Browse files
committed
chore: configure Aspect Workflows external remote cache for local development
1 parent 122b53a commit fbaffc8

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

.aspect/bazelrc/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
user.bazelrc
2+
remote-cache.bazelrc

.aspect/workflows/terraform/workflows.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,9 @@ module "aspect_workflows_grafana_dashboards" {
197197
grafana_url = module.managed_grafana.grafana_endpoint
198198
managed_prometheus_endpoint = module.aspect_workflows.managed_prometheus_endpoint
199199
}
200+
201+
resource "aws_ssm_parameter" "external_cache_endpoint" {
202+
name = "aw_external_cache_endpoint"
203+
type = "String"
204+
value = module.aspect_workflows.external_remote_cache_endpoint
205+
}

.bazelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ common --noincompatible_disallow_empty_glob
2323
common --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
2424
common --incompatible_enable_cc_toolchain_resolution
2525

26+
# Load any settings & overrides specific to the external remote cache from `.aspect/bazelrc/remote-cache.bazelrc`.
27+
# This file should appear in `.gitignore` so that settings are not shared with team members. This
28+
# should be last statement in this config so the user configuration is able to overwrite flags from
29+
# this file. See https://bazel.build/configure/best-practices#bazelrc-file.
30+
# Setup of this file is automated by running the setup_remote_cache.sh Bash script.
31+
try-import %workspace%/.aspect/bazelrc/remote-cache.bazelrc
32+
2633
# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
2734
# This file should appear in `.gitignore` so that settings are not shared with team members. This
2835
# should be last statement in this config so the user configuration is able to overwrite flags from

setup_remote_cache.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Fetch the external remote cache configuration and add it to the user's Bazel RC file.
4+
5+
set -o errexit -o nounset -o pipefail
6+
7+
ENDPOINT=$(aws ssm get-parameter --region us-west-2 --name "aw_external_cache_endpoint" --query Parameter.Value --output text)
8+
AUTH_STRING=$(aws ssm get-parameter --region us-west-2 --with-decryption --name "aw_external_cache_auth_header" --query Parameter.Value --output text)
9+
SELF_PATH=$(dirname "${BASH_SOURCE[0]:-"$(command -v -- "$0")"}")
10+
11+
echo -e "build --remote_cache=\"grpcs://${ENDPOINT}:8980\" --remote_header=\"Authorization=Basic ${AUTH_STRING}\" --remote_accept_cached --remote_upload_local_results" >"${SELF_PATH}/.aspect/bazelrc/remote-cache.bazelrc"

0 commit comments

Comments
 (0)