grpc_bazel_on_foundry_base.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env bash
  2. # Copyright 2017 gRPC authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. set -ex
  16. # change to grpc repo root
  17. cd $(dirname $0)/../../..
  18. source tools/internal_ci/helper_scripts/prepare_build_linux_rc
  19. # make sure bazel is available
  20. tools/bazel version
  21. # to get "bazel" link for kokoro build, we need to generate
  22. # invocation UUID, set a flag for bazel to use it
  23. # and upload "bazel_invocation_ids" file as artifact.
  24. BAZEL_INVOCATION_ID="$(uuidgen)"
  25. echo "${BAZEL_INVOCATION_ID}" >"${KOKORO_ARTIFACTS_DIR}/bazel_invocation_ids"
  26. tools/bazel \
  27. --bazelrc=tools/remote_build/kokoro.bazelrc \
  28. test \
  29. --invocation_id="${BAZEL_INVOCATION_ID}" \
  30. --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh \
  31. $@ \
  32. -- //test/... || FAILED="true"
  33. if [ "$UPLOAD_TEST_RESULTS" != "" ]
  34. then
  35. # Sleep to let ResultStore finish writing results before querying
  36. sleep 60
  37. python3 ./tools/run_tests/python_utils/upload_rbe_results.py
  38. fi
  39. if [ "$FAILED" != "" ]
  40. then
  41. exit 1
  42. fi