-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add remote caching to bazel builds (#10767)
* Add remote cache to linux builds * Remove BES flags * Remove BES flags from the right file * Migrate all Bazel kokoro builds to use remote caching * Remove BES logic * Fix mac ruby tests * Give mac/windows builds GCP access * Adding quotes to prevent issues with common flags * Adding command echoing in windows builds * Try enabling command echoing again * Adding invocation id for windows bazel build * Third try * Adding credentials to windows build
- Loading branch information
1 parent
7d1362c
commit 79564c5
Showing
24 changed files
with
376 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
# Helper for setting up common bazel flags in Kokoro. | ||
# | ||
# This script prints extra flags to a bazel invocation when it is run from | ||
# Kokoro. When the special environment variables are not present (e.g., if you | ||
# run Kokoro build scripts locally), this script only flips some debug settings. | ||
# | ||
# Example of running directly: | ||
# bazel test $(path/to/bazel_flags.sh) //... | ||
|
||
function bazel_flags::gen_invocation_id() { | ||
# Create a new invocation ID and store in the artifacts dir. | ||
local _invocation_id=$(uuidgen | tr A-Z a-z) | ||
|
||
# Put the new invocation ID at the start of the output IDs file. Some | ||
# Google-internal tools only look at the first entry, so this ensures the most | ||
# recent entry is first. | ||
local _ids_file=${KOKORO_ARTIFACTS_DIR}/bazel_invocation_ids | ||
local _temp_ids=$(mktemp) | ||
echo ${_invocation_id} > ${_temp_ids} | ||
[[ -e ${_ids_file} ]] && cat ${_ids_file} >> ${_temp_ids} | ||
mv -f ${_temp_ids} ${_ids_file} | ||
|
||
echo -n ${_invocation_id} | ||
} | ||
|
||
# Prints flags to use on Kokoro. | ||
function bazel_flags::kokoro_flags() { | ||
[[ -n ${KOKORO_JOB_NAME:-} ]] || return | ||
|
||
local -a _flags | ||
_flags+=( | ||
--invocation_id=$(bazel_flags::gen_invocation_id) | ||
--remote_cache=https://storage.googleapis.com/protobuf-bazel-cache/${KOKORO_JOB_NAME} | ||
) | ||
if [[ -n ${KOKORO_BAZEL_AUTH_CREDENTIAL:-} ]]; then | ||
_flags+=( --google_credentials=${KOKORO_BAZEL_AUTH_CREDENTIAL} ) | ||
else | ||
_flags+=( --google_default_credentials=true ) | ||
fi | ||
|
||
echo "${_flags[@]}" | ||
} | ||
|
||
echo "$(bazel_flags::kokoro_flags) --keep_going --test_output=errors" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.