Skip to content

Commit 74eca7d

Browse files
oharboeclaude
andcommitted
bazel-hermetic: preserve cloud credential env for remote cache auth
Gemini: env -i strips the credentials bazel needs to authenticate to cloud remote-cache / remote-execution backends (GCS, S3), so a build that relies on the remote cache would fail to authenticate. Preserve GOOGLE_APPLICATION_CREDENTIALS and the common AWS_* variables alongside the proxy/TLS/bazelisk config already passed through — same rationale: auth/cache configuration is not toolchain leakage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent b61f9d3 commit 74eca7d

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

etc/bazel-hermetic

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,18 @@ esac
182182
# downloads must work behind corporate proxies, custom CAs, and git-over-ssh
183183
# overrides, and users may relocate caches and tmp. The BAZELISK_* / token
184184
# vars matter when the resolved bazel is a bazelisk wrapper used directly
185-
# (custom cache location, enterprise mirror, GitHub rate limits).
185+
# (custom cache location, enterprise mirror, GitHub rate limits). The cloud
186+
# credential vars keep remote cache/execution auth (GCS, S3) working under
187+
# env -i.
186188
preserved_env=()
187189
for var in http_proxy https_proxy no_proxy HTTP_PROXY HTTPS_PROXY NO_PROXY \
188190
SSH_AUTH_SOCK SSL_CERT_FILE SSL_CERT_DIR XDG_CACHE_HOME TMPDIR \
189191
DISPLAY WAYLAND_DISPLAY XAUTHORITY \
190-
BAZELISK_HOME BAZELISK_BASE_URL BAZELISK_GITHUB_TOKEN GITHUB_TOKEN; do
192+
BAZELISK_HOME BAZELISK_BASE_URL BAZELISK_GITHUB_TOKEN GITHUB_TOKEN \
193+
GOOGLE_APPLICATION_CREDENTIALS \
194+
AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN \
195+
AWS_ROLE_ARN AWS_WEB_IDENTITY_TOKEN_FILE AWS_SHARED_CREDENTIALS_FILE \
196+
AWS_PROFILE AWS_CONFIG_FILE AWS_DEFAULT_REGION AWS_REGION; do
191197
# Pure-bash indirect lookup, no subprocess and no eval: ${!var+x} tests
192198
# whether the variable named by $var is set (set -u-safe), then ${!var}
193199
# reads its value.

0 commit comments

Comments
 (0)