Skip to content

Commit

Permalink
chore: Add build mode to the local build_and_test script
Browse files Browse the repository at this point in the history
Bug: b/381912742
Change-Id: Ifaaf2cad6e420e6879edbc75afa7d1db47f9812c
GitOrigin-RevId: 113726032934e5230a828db6c66a84b3f655b830
  • Loading branch information
emmafu2022 authored and copybara-github committed Dec 18, 2024
1 parent 7e158a1 commit 0036115
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion production/packaging/local/build_and_test
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ function _print_runtime() {
exit ${STATUS}
}

# Default mode to nonprod to build local server and tools to enable all the loggings.
declare MODE=nonprod

function usage() {
local exitval=${1-1}
cat &>/dev/stderr <<USAGE
Expand All @@ -40,6 +43,7 @@ usage:
--without-shared-cache Containers will not mount ${HOME}/.cache/bazel
--no-precommit Skip precommit checks
--with-tests Also runs tests before building
--mode <type> Mode can be prod or nonprod. Default: ${MODE}
environment variables (all optional):
WORKSPACE Set the path to the workspace (repo root)
Expand All @@ -63,6 +67,11 @@ while [[ $# -gt 0 ]]; do
BUILD_AND_TEST_ARGS+=("--with-tests")
shift
;;
--mode)
MODE="$2"
shift
shift
;;
--verbose)
BUILD_AND_TEST_ARGS+=("--verbose")
set -o xtrace
Expand Down Expand Up @@ -101,6 +110,6 @@ fi
source "${BUILDER}" || fail "Failed to source builder.sh"

printf "==== Running build_and_test_all_in_docker =====\n"
if ! "${WORKSPACE}"/production/packaging/build_and_test_all_in_docker "${BUILD_AND_TEST_ARGS[@]}" --instance local --platform local; then
if ! "${WORKSPACE}"/production/packaging/build_and_test_all_in_docker "${BUILD_AND_TEST_ARGS[@]}" --instance local --platform local --mode "${MODE}"; then
fail "Failed to run build_and_test_all_in_docker"
fi

0 comments on commit 0036115

Please sign in to comment.