Skip to content

Commit ab16b48

Browse files
author
Tyler Smalley
authored
[ci] Disable Bazel cache on CI (elastic#115428)
This is a short-term solution to reduce our hit count in Buildkite due to the increase in bootstraps so we can move forward with enabling Buildkite across all PRs.
1 parent db53a79 commit ab16b48

File tree

9 files changed

+44
-39
lines changed

9 files changed

+44
-39
lines changed

.bazelrc

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ build --remote_timeout=30
1010
build --remote_header=x-buildbuddy-api-key=3EYk49W2NefOx2n3yMze
1111
build --remote_accept_cached=true
1212

13-
# BuildBuddy
14-
## Metadata settings
15-
build --workspace_status_command="node ./src/dev/bazel_workspace_status.js"
1613
# Enable this in case you want to share your build info
1714
# build --build_metadata=VISIBILITY=PUBLIC
1815
build --build_metadata=TEST_GROUPS=//packages

.bazelrc.common

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ test --incompatible_strict_action_env
120120
# collect coverage information from test targets
121121
coverage --instrument_test_targets
122122

123-
# Settings for CI
124-
# Bazel flags for CI are in /src/dev/ci_setup/.bazelrc-ci
123+
# Metadata settings
124+
build --workspace_status_command="node ./src/dev/bazel_workspace_status.js"
125125

126126
# Load any settings specific to the current user.
127127
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members

.buildkite/pipelines/on_merge.yml

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ steps:
99

1010
- command: .buildkite/scripts/steps/on_merge_build_and_metrics.sh
1111
label: Default Build and Metrics
12+
env:
13+
BAZEL_CACHE_MODE: read-write
1214
agents:
1315
queue: c2-8
1416

.buildkite/scripts/bootstrap.sh

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
set -euo pipefail
44

55
source .buildkite/scripts/common/util.sh
6+
source .buildkite/scripts/common/setup_bazel.sh
67

78
echo "--- yarn install and bootstrap"
89
retry 2 15 yarn kbn bootstrap

.buildkite/scripts/common/persist_bazel_cache.sh

-15
This file was deleted.
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
3+
source .buildkite/scripts/common/util.sh
4+
5+
KIBANA_BUILDBUDDY_CI_API_KEY=$(retry 5 5 vault read -field=value secret/kibana-issues/dev/kibana-buildbuddy-ci-api-key)
6+
export KIBANA_BUILDBUDDY_CI_API_KEY
7+
8+
echo "[bazel] writing .bazelrc"
9+
cat <<EOF > $KIBANA_DIR/.bazelrc
10+
# Generated by .buildkite/scripts/common/setup_bazel.sh
11+
12+
import %workspace%/.bazelrc.common
13+
14+
build --build_metadata=ROLE=CI
15+
EOF
16+
17+
if [[ "${BAZEL_CACHE_MODE:-none}" == read* ]]; then
18+
echo "[bazel] enabling caching"
19+
cat <<EOF >> $KIBANA_DIR/.bazelrc
20+
build --bes_results_url=https://app.buildbuddy.io/invocation/
21+
build --bes_backend=grpcs://cloud.buildbuddy.io
22+
build --remote_cache=grpcs://cloud.buildbuddy.io
23+
build --remote_timeout=3600
24+
build --remote_header=x-buildbuddy-api-key=$KIBANA_BUILDBUDDY_CI_API_KEY
25+
EOF
26+
fi
27+
28+
if [[ "${BAZEL_CACHE_MODE:-none}" == "read" ]]; then
29+
echo "[bazel] cache set to read-only"
30+
cat <<EOF >> $KIBANA_DIR/.bazelrc
31+
build --noremote_upload_local_results
32+
EOF
33+
fi
34+
35+
if [[ "${BAZEL_CACHE_MODE:-none}" != @(read|read-write|none|) ]]; then
36+
echo "invalid value for BAZEL_CACHE_MODE received ($BAZEL_CACHE_MODE), expected one of [read,read-write,none]"
37+
exit 1
38+
fi

.buildkite/scripts/common/util.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ verify_no_git_changes() {
1818
RED='\033[0;31m'
1919
C_RESET='\033[0m' # Reset color
2020

21-
GIT_CHANGES="$(git ls-files --modified)"
21+
GIT_CHANGES="$(git ls-files --modified -- . ':!:.bazelrc')"
2222
if [ "$GIT_CHANGES" ]; then
2323
echo -e "\n${RED}ERROR: '$1' caused changes to the following files:${C_RESET}\n"
2424
echo -e "$GIT_CHANGES\n"

.buildkite/scripts/steps/on_merge_build_and_metrics.sh

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
set -euo pipefail
44

5-
# Write Bazel cache for Linux
6-
.buildkite/scripts/common/persist_bazel_cache.sh
7-
85
.buildkite/scripts/bootstrap.sh
96
.buildkite/scripts/build_kibana.sh
107
.buildkite/scripts/post_build_kibana.sh

src/dev/ci_setup/.bazelrc-ci

-15
This file was deleted.

0 commit comments

Comments
 (0)