From bb7993168370e5dd28cd5904b2100583038335be Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Sun, 30 Oct 2022 06:18:12 +0100 Subject: [PATCH] Standard bazel commands + remote_def --- hack/bazel_setup.sh | 16 ++++++++++++++++ hack/gofmt_check.sh | 4 +++- hack/non_manual_build.sh | 4 +++- hack/unit_tests.sh | 4 +++- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 hack/bazel_setup.sh diff --git a/hack/bazel_setup.sh b/hack/bazel_setup.sh new file mode 100644 index 00000000..2b0f6b93 --- /dev/null +++ b/hack/bazel_setup.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +export SILO_KEY=rocky86-peridot-prow-1 +export REMOTE_DEF=cache-silo-key=$SILO_KEY + +CI=${CI:-} +FLAGS="--show_progress_rate_limit=5 --color=yes --ui_actions_shown=30 --terminal_columns=140 --show_timestamps --verbose_failures --announce_rc --experimental_repository_cache_hardlinks --disk_cache= --sandbox_tmpfs_path=/tmp --experimental_guard_against_concurrent_changes" + +if [[ -n ${CI} ]]; then + FLAGS="--config=ci $FLAGS" +fi + +BAZEL_B="bazel $SOPTIONS build $FLAGS --remote_default_exec_properties=$REMOTE_DEF" +BAZEL_R="bazel $SOPTIONS run $FLAGS --remote_default_exec_properties=$REMOTE_DEF" +BAZEL_T="bazel $SOPTIONS test $FLAGS --remote_default_exec_properties=$REMOTE_DEF --test_arg=-test.v --flaky_test_attempts=3 --build_tests_only --test_output=errors" +BAZEL_QR="bazel $SOPTIONS query --keep_going --noshow_progress" diff --git a/hack/gofmt_check.sh b/hack/gofmt_check.sh index 545b3a92..8b51df63 100755 --- a/hack/gofmt_check.sh +++ b/hack/gofmt_check.sh @@ -2,7 +2,9 @@ set -o errexit -bazel build --config=ci @go_sdk//... +source hack/bazel_setup.sh + +$BAZEL_B @go_sdk//... GO_BIN="$(bazel info output_base)/external/go_sdk/bin/go" diff --git a/hack/non_manual_build.sh b/hack/non_manual_build.sh index 5856a0a1..00abbf7f 100755 --- a/hack/non_manual_build.sh +++ b/hack/non_manual_build.sh @@ -3,4 +3,6 @@ set -o errexit set -x -bazel build --config=ci $(bazel query "//... except attr(tags, 'manual', //...) except //vendor/...") +source hack/bazel_setup.sh + +$BAZEL_B $(BAZEL_QR query "//... except attr(tags, 'manual', //...) except //vendor/...") diff --git a/hack/unit_tests.sh b/hack/unit_tests.sh index 268d372a..3f1c06b6 100755 --- a/hack/unit_tests.sh +++ b/hack/unit_tests.sh @@ -3,4 +3,6 @@ set -o errexit set -x -bazel test --config=ci //... +source hack/bazel_setup.sh + +$BAZEL_T //...