mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00

It is sometimes hard to find all failing tests in buildkite output logs - even filtering for "FAILED" is cumbersome as the output can be overloaded. This PR adds a small utility to add a short summary log in a separate output section at the end of the buildkite job. The only shared directory between the Buildkite host machine and the test docker container is `/tmp/artifacts:/artifact-mount`. Thus, we write the summary file to this directory, and delete it before actually uploading it as an artifact in the `post-commands` hook.
21 lines
1.1 KiB
Bash
21 lines
1.1 KiB
Bash
#!/bin/bash
|
|
# This script is executed by Buildkite on the host machine.
|
|
# In contrast, our build jobs are run in Docker containers.
|
|
# This means that even though our build jobs write to
|
|
# `/artifact-mount`, the directory on the host machine is
|
|
# actually `/tmp/artifacts`.
|
|
# Here, we cat all text files in artifact-mount/test-summaries
|
|
# and upload them as a Buildkite annotation.
|
|
# These files contain a condensed summary of all failing pytest
|
|
# 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
|
|
if [ -d "/tmp/artifacts/test-summaries" ] && [ "$(ls -A /tmp/artifacts/test-summaries)" ]; then
|
|
cat /tmp/artifacts/test-summaries/*.txt | buildkite-agent annotate --job "${BUILDKITE_JOB_ID}" --append --style error --context "${BUILDKITE_JOB_ID}"
|
|
|
|
# Remove test summaries files (don't actually upload as artifacts)
|
|
# This has to be done with docker to avoid permission issues
|
|
echo "--- Cleaning up"
|
|
docker run --rm -v /tmp/artifacts:/artifact-mount alpine:latest /bin/sh -c 'rm -rf /artifact-mount/test-summaries' || true
|
|
fi
|