mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add local hooks for BuildKite.
PiperOrigin-RevId: 347044353
This commit is contained in:
committed by
gVisor bot
parent
3c673caf86
commit
76c2f21cec
@@ -0,0 +1,24 @@
|
||||
# Upload test logs on failure, if there are any.
|
||||
if [[ "${BUILDKITE_COMMAND_EXIT_STATUS}" -ne "0" ]]; then
|
||||
declare log_count=0
|
||||
for log in $(make testlogs 2>/dev/null | sort | uniq); do
|
||||
buildkite-agent artifact upload "${log}"
|
||||
log_count=$((${log_count}+1))
|
||||
# N.B. If *all* tests fail due to some common cause, then we will
|
||||
# end up spending way too much time uploading logs. Instead, we just
|
||||
# upload the first 100 and stop. That is hopefully enough to debug.
|
||||
if [[ "${log_count}" -ge 100 ]]; then
|
||||
echo "Only uploaded first 100 failures; skipping the rest."
|
||||
break
|
||||
fi
|
||||
done
|
||||
# Attempt to clear the cache and shut down.
|
||||
make clean || echo "make clean failed with code $?"
|
||||
make bazel-shutdown || echo "make bazel-shutdown failed with code $?"
|
||||
fi
|
||||
|
||||
# Kill any running containers (clear state).
|
||||
CONTAINERS="$(docker ps -q)"
|
||||
if ! [[ -z "${CONTAINERS}" ]]; then
|
||||
docker container kill ${CONTAINERS} 2>/dev/null || true
|
||||
fi
|
||||
@@ -0,0 +1,10 @@
|
||||
# Setup for parallelization with PARTITION and TOTAL_PARTITIONS.
|
||||
export PARTITION=${BUILDKITE_PARALLEL_JOB:-0}
|
||||
PARTITION=$((${PARTITION}+1)) # 1-indexed, but PARALLEL_JOB is 0-indexed.
|
||||
export TOTAL_PARTITIONS=${BUILDKITE_PARALLEL_JOB_COUNT:-1}
|
||||
|
||||
# Ensure Docker has experimental enabled.
|
||||
if ! grep experimental /etc/docker/daemon.json >/dev/null; then
|
||||
make sudo TARGETS=//runsc:runsc ARGS="install --experimental=true"
|
||||
sudo systemctl reload docker
|
||||
fi
|
||||
Reference in New Issue
Block a user