Ensure Full Build is Run for each Bazel Version in Bazel Distribtest (#31366)

* Ensure results of Bazel distribtests are not cached across versions.

* Please the shellcheck overlords

* Try to use action env to invalidate cache

* Change placement of Bazel version check

* Review comments

* Add version test to build step as well
pull/31151/merge
Richard Belleville 2 years ago committed by GitHub
parent 50d4f22069
commit a1491cd738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      test/distrib/bazel/test_single_bazel_version.sh

@ -51,12 +51,17 @@ FAILED_TESTS=""
export OVERRIDE_BAZEL_VERSION="$VERSION"
# when running under bazel docker image, the workspace is read only.
export OVERRIDE_BAZEL_WRAPPER_DOWNLOAD_DIR=/tmp
bazel build -- //... "${EXCLUDED_TARGETS[@]}" || FAILED_TESTS="${FAILED_TESTS}Build "
ACTION_ENV_FLAG="--action_env=bazel_cache_invalidate=version_${VERSION}"
tools/bazel test "${ACTION_ENV_FLAG}" --test_output=all //:all || FAILED_TESTS="${FAILED_TESTS}${TEST_DIRECTORY} Build"
tools/bazel build "${ACTION_ENV_FLAG}" -- //... "${EXCLUDED_TARGETS[@]}" || FAILED_TESTS="${FAILED_TESTS} Build"
for TEST_DIRECTORY in "${TEST_DIRECTORIES[@]}"; do
pushd "test/distrib/bazel/$TEST_DIRECTORY/"
bazel test --test_output=all //:all || FAILED_TESTS="${FAILED_TESTS}${TEST_DIRECTORY} Distribtest"
tools/bazel version | grep "$VERSION" || { echo "Detected bazel version did not match expected value of $VERSION" >/dev/stderr; exit 1; }
tools/bazel test "${ACTION_ENV_FLAG}" --test_output=all //:all || FAILED_TESTS="${FAILED_TESTS}${TEST_DIRECTORY} Distribtest"
popd
done

Loading…
Cancel
Save