Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(NA): integrate build buddy with our bazel setup and remote cache for ci #90116

Merged
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b904e12
chore(NA): simple changes on bazelrc
mistic Feb 3, 2021
efb6a45
chore(NA): integrate bazel tools with BuildBuddy and remote cache ser…
mistic Feb 3, 2021
6cc51bd
chore(NA) fix bazelrc line config
mistic Feb 3, 2021
51bd510
chore(NA): move non auth settings out of bazelrc.auth
mistic Feb 3, 2021
64a800a
chore(NA): output home dir
mistic Feb 3, 2021
d35c51b
chore(NA): load .bazelrc-ci.auth from /Users/tiagocosta dir
mistic Feb 3, 2021
2212d31
chore(NA): remove bazelrc auth file and append directly into home baz…
mistic Feb 3, 2021
e1d799a
Merge branch 'master' into integrate-build-buddy-with-our-bazel-setup
kibanamachine Feb 3, 2021
faaec4e
Merge branch 'master' into integrate-build-buddy-with-our-bazel-setup
kibanamachine Feb 3, 2021
5e381c9
Merge branch 'master' into integrate-build-buddy-with-our-bazel-setup
kibanamachine Feb 3, 2021
4571570
Merge branch 'master' into integrate-build-buddy-with-our-bazel-setup
kibanamachine Feb 4, 2021
f415c2c
Merge branch 'master' into integrate-build-buddy-with-our-bazel-setup
kibanamachine Feb 4, 2021
2a6b691
Merge branch 'master' into integrate-build-buddy-with-our-bazel-setup
kibanamachine Feb 4, 2021
347fc13
chore(NA): comment announce option
mistic Feb 4, 2021
56ad7c5
chore(NA): integrate build buddy metadata
mistic Feb 4, 2021
1dc7faf
chore(NA): update src/dev/ci_setup/.bazelrc-ci
mistic Feb 4, 2021
12e7c10
chore(NA): move build metadata integation to common confdig
mistic Feb 4, 2021
b1bc6c1
chore(NA): merge and solve conflicts with master
mistic Feb 4, 2021
5a280f0
chore(NA): fix problem on bazel file location
mistic Feb 4, 2021
71a9214
chore(NA): correct sh file permissions
mistic Feb 4, 2021
f831fbe
chore(NA): only get host on CI
mistic Feb 4, 2021
889340d
chore(NA): add cores into host info on CI
mistic Feb 4, 2021
c5cd6ca
Merge branch 'master' into integrate-build-buddy-with-our-bazel-setup
kibanamachine Feb 4, 2021
2c467cd
chore(NA): sync with last settings to setup bazelisk tools on ci
mistic Feb 4, 2021
4267ea0
chore(NA): sync last changes on ci setup env
mistic Feb 4, 2021
cc503f8
chore(NA): sync settings on ci setup with the other PR
mistic Feb 5, 2021
f8a2e67
Merge remote-tracking branch 'upstream/master' into integrate-build-b…
mistic Feb 5, 2021
f55f27c
chore(NA): merge and solve conflicts with master
mistic Feb 5, 2021
857058a
chore(NA): remove yarn export
mistic Feb 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
# Import shared settings first so we can override below
import %workspace%/.bazelrc.common

## Disabled for now
# Remote cache settings for local env
# build --remote_cache=https://storage.googleapis.com/kibana-bazel-cache
# build --incompatible_remote_results_ignore_disk=true
# build --remote_accept_cached=true
# build --remote_upload_local_results=false

# BuildBuddy
## Metadata settings
build --workspace_status_command=$(pwd)/src/dev/bazel_workspace_status.sh
# Enable this in case you want to share your build info
# build --build_metadata=VISIBILITY=PUBLIC
build --build_metadata=TEST_GROUPS=//packages

57 changes: 57 additions & 0 deletions src/dev/bazel_workspace_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# Inspired on https://github.com/buildbuddy-io/buildbuddy/blob/master/workspace_status.sh
# This script will be run bazel when building process starts to
# generate key-value information that represents the status of the
# workspace. The output should be like
#
# KEY1 VALUE1
# KEY2 VALUE2
#
# If the script exits with non-zero code, it's considered as a failure
# and the output will be discarded.

# Git repo
repo_url=$(git config --get remote.origin.url)
if [[ $? != 0 ]];
then
exit 1
fi
echo "REPO_URL ${repo_url}"

# Commit SHA
commit_sha=$(git rev-parse HEAD)
if [[ $? != 0 ]];
then
exit 1
fi
echo "COMMIT_SHA ${commit_sha}"

# Git branch
repo_url=$(git rev-parse --abbrev-ref HEAD)
if [[ $? != 0 ]];
then
exit 1
fi
echo "GIT_BRANCH ${repo_url}"

# Tree status
git diff-index --quiet HEAD --
if [[ $? == 0 ]];
then
tree_status="Clean"
else
tree_status="Modified"
fi
echo "GIT_TREE_STATUS ${tree_status}"

# Host
if [ "$CI" = "true" ]; then
host=$(hostname | sed 's|\(.*\)-.*|\1|')
cores=$(grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}' )
if [[ $? != 0 ]];
then
exit 1
fi
echo "HOST ${host}-${cores}"
fi
12 changes: 9 additions & 3 deletions src/dev/ci_setup/.bazelrc-ci
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# Import and load bazelrc common settings for ci env
try-import %workspace%/src/dev/ci_setup/.bazelrc-ci.common

# Remote cache settings for ci env
# build --google_default_credentials
# build --remote_upload_local_results=true
# BuildBuddy settings
## Remote settings including cache
build --bes_results_url=https://app.buildbuddy.io/invocation/
build --bes_backend=grpcs://cloud.buildbuddy.io
build --remote_cache=grpcs://cloud.buildbuddy.io
build --remote_timeout=3600

## Metadata settings
build --build_metadata=ROLE=CI
2 changes: 1 addition & 1 deletion src/dev/ci_setup/.bazelrc-ci.common
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
build --noshow_progress

# Print all the options that apply to the build.
build --announce_rc
# build --announce_rc

# More details on failures
build --verbose_failures=true
3 changes: 3 additions & 0 deletions src/dev/ci_setup/load_env_keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ else
PERCY_TOKEN=$(retry 5 vault read -field=value secret/kibana-issues/dev/percy)
export PERCY_TOKEN

KIBANA_BUILDBUDDY_CI_API_KEY=$(retry 5 vault read -field=value secret/kibana-issues/dev/kibana-buildbuddy-ci-api-key)
export KIBANA_BUILDBUDDY_CI_API_KEY

# remove vault related secrets
unset VAULT_ROLE_ID VAULT_SECRET_ID VAULT_TOKEN VAULT_ADDR
fi
15 changes: 11 additions & 4 deletions src/dev/ci_setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ echo " -- PARENT_DIR='$PARENT_DIR'"
echo " -- KIBANA_PKG_BRANCH='$KIBANA_PKG_BRANCH'"
echo " -- TEST_ES_SNAPSHOT_VERSION='$TEST_ES_SNAPSHOT_VERSION'"

###
### copy .bazelrc-ci into $HOME/.bazelrc
###
cp "src/dev/ci_setup/.bazelrc-ci" "$HOME/.bazelrc";

###
### append auth token to buildbuddy into "$HOME/.bazelrc";
###
echo "# Appended by src/dev/ci_setup/setup.sh" >> "$HOME/.bazelrc"
echo "build --remote_header=x-buildbuddy-api-key=$KIBANA_BUILDBUDDY_CI_API_KEY" >> "$HOME/.bazelrc"

###
### install dependencies
###
Expand Down Expand Up @@ -66,7 +77,3 @@ if [ "$GIT_CHANGES" ]; then
exit 1
fi

###
### copy .bazelrc-ci into $HOME/.bazelrc
###
cp "src/dev/ci_setup/.bazelrc-ci" "$HOME/.bazelrc";