Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ur-build-hw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ env:
UR_LOG_NATIVE_CPU: "level:error;flush:error"
UR_LOG_OPENCL: "level:error;flush:error"

# Free disk on the runner host before Docker must be enforced with a self-hosted
# job-started hook (same machine as the job). A separate workflow job with the
# same runs-on labels can land on a different host. See:
# devops/scripts/gha_runner_job_started_hook.sh
jobs:
adapter_build_hw:
name: Build & CTS
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ur-build-offload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: UR - Build offload adapter

permissions: read-all

# Pre-container disk check: use ACTIONS_RUNNER_HOOK_JOB_STARTED on self-hosted
# runners — see devops/scripts/gha_runner_job_started_hook.sh
on: [ workflow_call, workflow_dispatch ]

jobs:
Expand Down
35 changes: 35 additions & 0 deletions devops/scripts/gha_runner_job_started_hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# Self-hosted GitHub Actions runner — job-started hook (runs on the HOST).
#
# Configure on each runner machine, e.g. in the service environment:
# ACTIONS_RUNNER_HOOK_JOB_STARTED=/path/to/llvm/devops/scripts/gha_runner_job_started_hook.sh
#
# GitHub runs this after a job is assigned to this runner but BEFORE the job
# container is created, so the check applies to the same host that will pull
# and run Docker (unlike a separate workflow job with the same runs-on labels,
# which may run on a different machine in the pool).
#
# Optional: UR_CI_MIN_FREE_DISK_MB (default 20480) — minimum free space on / in MiB.
#
# https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/running-scripts-before-or-after-a-job

set -euo pipefail

MIN_MB="${UR_CI_MIN_FREE_DISK_MB:-20480}"

if ! command -v df >/dev/null 2>&1; then
echo "WARNING: df not available; skipping UR CI disk preflight"
exit 0
fi

avail_kb="$(df -Pk / | awk 'NR==2 {print $4}')"
avail_mb=$((avail_kb / 1024))

echo "gha_runner_job_started_hook: free on / = ${avail_mb} MiB (minimum ${MIN_MB} MiB)"

if [ "$avail_mb" -lt "$MIN_MB" ]; then
echo "ERROR: insufficient disk space on runner host (${avail_mb} MiB free, need at least ${MIN_MB} MiB)"
exit 1
fi

exit 0
Loading