upload_build_info.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env bash
  2. # Cause the script to exit if a single command fails.
  3. set -ex
  4. ROOT_DIR=$(cd "$(dirname "$0")/$(dirname "$(test -L "$0" && readlink "$0" || echo "/")")"; pwd)
  5. RAY_DIR=$(cd "${ROOT_DIR}/../../"; pwd)
  6. cd "${RAY_DIR}"
  7. cleanup() {
  8. # Cleanup the directory because macOS file system is shared between builds.
  9. rm -rf /tmp/bazel_event_logs
  10. }
  11. trap cleanup EXIT
  12. mkdir -p /tmp/bazel_event_logs
  13. ./ci/build/get_build_info.py > /tmp/bazel_event_logs/metadata.json
  14. if [[ -z "${BUILDKITE-}" ]]; then
  15. # Codepath for Github Actions and Travis CI
  16. pip install -q awscli
  17. # Strip the leading "refs/heads/" in the posssible branch tag
  18. TRAVIS_BRANCH=${TRAVIS_BRANCH/refs\/heads\//}
  19. export AWS_ACCESS_KEY_ID=AKIAQQPDA73RF7PSLH5N
  20. export AWS_SECRET_ACCESS_KEY=${BAZEL_LOG_BUCKET_ACCESS_KEY}
  21. export AWS_DEFAULT_REGION=us-west-2
  22. DST="s3://ray-travis-logs/bazel_events/$TRAVIS_BRANCH/$TRAVIS_COMMIT/$TRAVIS_JOB_ID"
  23. echo "Uploading log to ${DST}"
  24. aws s3 cp --recursive /tmp/bazel_event_logs "${DST}"
  25. else
  26. # Codepath for Buildkite
  27. pip install -q docker aws_requests_auth boto3
  28. python .buildkite/copy_files.py --destination logs --path /tmp/bazel_event_logs
  29. fi