blob: b8230e4708fa93a5b80f918f5e6d8a9b574c188d [file] [log] [blame]
#!/bin/bash
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
# This is the CI version of `bazelisk.sh`, which calls into the "usual" wrapper,
# but adds various flags to produce CI-friendly output. It does so by prociding a
# command-line specified .bazelrc (that is applied alongside //.bazelrc).
# An additional bazelrc must be synthesized to specify precisely how to use the
# GCP bazel cache.
GCP_BAZELRC="$(mktemp /tmp/XXXXXX.bazelrc)"
trap "rm $GCP_BAZELRC" EXIT
if [[ -n "$GCP_BAZEL_CACHE_KEY" && -f "$GCP_BAZEL_CACHE_KEY" ]]; then
echo "Applying GCP cache key; will upload to the cache."
echo "build --google_credentials=$GCP_BAZEL_CACHE_KEY" > "$GCP_BAZELRC"
else
echo "No key/invalid path to key. Download from cache only."
echo "build --remote_upload_local_results=false" > "$GCP_BAZELRC"
fi
"$(dirname $0)"/../bazelisk.sh \
--bazelrc="$GCP_BAZELRC" \
--bazelrc="$(dirname $0)"/.bazelrc \
$@