Skip to content

Commit

Permalink
[ci] remove bazel logs only on mac (#42170)
Browse files Browse the repository at this point in the history
- As per comment on the code; remove bazel logs only on mac. Other platform runs in docker so it doesn't matter if the log is removed.
- Move all upload build info skipping logic into the script itself, and remove all the check from the caller. Also bring consistency on the skipping logic across various places (master branch only)

Signed-off-by: can <can@anyscale.com>
  • Loading branch information
can-anyscale authored Jan 5, 2024
1 parent cc61565 commit 005d1ab
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .buildkite/core.rayci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ steps:
- skip-on-premerge
instance_type: medium
commands:
- cleanup() { if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then ./ci/build/upload_build_info.sh; fi }; trap cleanup EXIT
- cleanup() { ./ci/build/upload_build_info.sh; }; trap cleanup EXIT
- (cd dashboard/client && npm ci && npm run build)
- pip install -e python[client]
- bazel test --config=ci --jobs=1 $(./ci/run/bazel_export_options)
Expand Down
8 changes: 7 additions & 1 deletion .buildkite/hooks/post-command
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
# tests to make it easy for users to see which tests are failing.
# Because we upload them to Buildkite, we don't need to
# upload them as artifacts and delete them afterwards.
set -e
set -ex

if [ -d "/tmp/artifacts/test-summaries" ] && [ "$(ls -A /tmp/artifacts/test-summaries)" ]; then
# Only upload annotations if there are at least 2 files in the directory:
# 1 header and 1 failed test.
Expand All @@ -23,3 +24,8 @@ if [ -d "/tmp/artifacts/test-summaries" ] && [ "$(ls -A /tmp/artifacts/test-summ
echo "--- Cleaning up"
docker run --rm -v /tmp/artifacts:/artifact-mount alpine:latest /bin/sh -c 'rm -rf /artifact-mount/test-summaries' || true
fi

# clean up bazel logs if any, this only has effect when the bazel test runs in the same
# environment as the buildkite job commands, and has no effect when the tests run
# inside another test container
rm -rf /tmp/bazel_event_logs
4 changes: 1 addition & 3 deletions .buildkite/windows_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ powershell ci/pipeline/fix-windows-bazel.ps1
readonly PIPELINE_POSTMERGE="0189e759-8c96-4302-b6b5-b4274406bf89"

cleanup() {
if [[ "${BUILDKITE_PIPELINE_ID:-}" == "${PIPELINE_POSTMERGE}" ]]; then
bash ./ci/build/upload_build_info.sh
fi
bash ./ci/build/upload_build_info.sh
}
trap cleanup EXIT

Expand Down
2 changes: 1 addition & 1 deletion ci/build/test-worker-in-container.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
cleanup() { if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then ./ci/build/upload_build_info.sh; fi }; trap cleanup EXIT
cleanup() { ./ci/build/upload_build_info.sh; }; trap cleanup EXIT

set -exo pipefail

Expand Down
11 changes: 3 additions & 8 deletions ci/build/upload_build_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ readonly PIPELINE_POSTMERGE="0189e759-8c96-4302-b6b5-b4274406bf89"
readonly PIPELINE_CIV1_BRANCH="0183465b-c6fb-479b-8577-4cfd743b545d"
if [[
"${BUILDKITE_PIPELINE_ID:-}" != "${PIPELINE_POSTMERGE}" &&
"${BUILDKITE_PIPELINE_ID:-}" != "${PIPELINE_CIV1_BRANCH}"
"${BUILDKITE_PIPELINE_ID:-}" != "${PIPELINE_CIV1_BRANCH}" &&
"${BUILDKITE_BRANCH:-}" != "master"
]]; then
echo "Skip build info uploading on non-postmerge pipeline."
echo "Skip build info uploading on master branch."
exit 0
fi

Expand All @@ -18,12 +19,6 @@ RAY_DIR=$(cd "${ROOT_DIR}/../../"; pwd)

cd "${RAY_DIR}"

cleanup() {
# Cleanup the directory because macOS file system is shared between builds.
rm -rf /tmp/bazel_event_logs
}
trap cleanup EXIT

mkdir -p /tmp/bazel_event_logs

./ci/build/get_build_info.py > /tmp/bazel_event_logs/metadata.json
Expand Down
13 changes: 4 additions & 9 deletions ci/ray_ci/tester_container.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import platform
import subprocess
from typing import List, Optional
Expand Down Expand Up @@ -81,14 +80,10 @@ def _run_tests_in_docker(
test_arg: Optional[str] = None,
) -> subprocess.Popen:
logger.info("Running tests: %s", test_targets)
commands = []
if os.environ.get("BUILDKITE_BRANCH", "") == "master":
commands.extend(
[
"cleanup() { ./ci/build/upload_build_info.sh; }",
"trap cleanup EXIT",
]
)
commands = [
"cleanup() { ./ci/build/upload_build_info.sh; }",
"trap cleanup EXIT",
]
if platform.system() == "Windows":
# allow window tests to access aws services
commands.append(
Expand Down

0 comments on commit 005d1ab

Please sign in to comment.