Skip to content

Commit 0d8bfba

Browse files
committed
combine scripts
1 parent 7801a47 commit 0d8bfba

File tree

3 files changed

+36
-27
lines changed

3 files changed

+36
-27
lines changed

.github/scripts/buildkitd.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,39 @@ echo "✅ Installed: $(buildkitd --version)"
4848

4949
# Cleanup
5050
rm -rf "$TMPDIR"
51+
52+
echo "🔍 Detecting largest non-system volume..."
53+
54+
# Use consistent, POSIX-compatible df output
55+
# Filter out ephemeral/system mounts
56+
mapfile -t lines < <(
57+
df -B1 --output=target,avail,fstype 2>/dev/null | \
58+
tail -n +2 | \
59+
awk '$3 !~ /(tmpfs|devtmpfs|overlay|squashfs|efivarfs|proc|sysfs|cgroup|debugfs|rpc_pipefs|run)/ {print $0}' | \
60+
sort -k2 -n -r
61+
)
62+
63+
if [ ${#lines[@]} -eq 0 ]; then
64+
echo "❌ No valid mounted volumes found."
65+
exit 1
66+
fi
67+
68+
read -r mount avail fstype <<<"${lines[0]}"
69+
70+
avail_h=$(numfmt --to=iec <<<"$avail" 2>/dev/null || echo "$avail bytes")
71+
echo "📦 Largest volume: $mount (Free: $avail_h, Type: $fstype)"
72+
73+
# Export variable for use by parent script
74+
echo "BUILD_VOLUME=$mount"
75+
76+
# Identify Buildkit root
77+
if [ "$BUILD_VOLUME" = "/" ]; then
78+
BUILD_ROOT="/buildkit"
79+
else
80+
BUILD_ROOT="$BUILD_VOLUME/buildkit"
81+
fi
82+
83+
sudo mkdir -p "$BUILD_ROOT"
84+
sudo chown root:root "$BUILD_ROOT"
85+
86+
echo "🧱 Using BuildKit root at: $BUILD_ROOT"

.github/scripts/volume.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/example.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ jobs:
3737
- uses: actions/checkout@v5
3838
- run: .github/scripts/runner_setup.sh
3939
- run: .github/scripts/buildkitd.sh
40-
- run: .github/scripts/volume.sh
4140

4241
example-on-g6xl-runner-1:
4342
needs: [example-on-build-runner]

0 commit comments

Comments
 (0)