From 1d06f63b4d767b9e2568c341b3b4d9487c9b05c1 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 5 Nov 2025 09:51:37 -0600 Subject: [PATCH 1/5] [copilot] fix disk space usage Context: https://github.com/dotnet/android/actions/runs/19085458511 Copilot is running out of disk space, but it has a second drive at `/mnt/` we could be using. * Create a symlink `./bin` -> `/mnt/bin` for all build output. * Set env vars for `/mnt/android-archives` and `/mnt/android-toolchain` --- .github/workflows/copilot-setup-steps.yml | 26 +++++++++ .github/workflows/log-disk-space/action.yml | 58 +++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 .github/workflows/log-disk-space/action.yml diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index e0f56fd2e78..7f2caaeb3d3 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -6,6 +6,9 @@ jobs: copilot-setup-steps: runs-on: ubuntu-latest timeout-minutes: 120 + env: + AndroidToolchainCacheDirectory: /mnt/android-archives + AndroidToolchainDirectory: /mnt/android-toolchain steps: - name: Checkout repository @@ -13,6 +16,24 @@ jobs: with: submodules: recursive + - name: Log disk space (after checkout) + uses: ./.github/workflows/log-disk-space + + - name: Setup build directories on secondary disk + run: | + echo "Setting up Android toolchain on /mnt (secondary disk with 66G+ free)" + mkdir -p /mnt/android-archives + mkdir -p /mnt/android-toolchain + mkdir -p /mnt/bin + + # Create symlink for bin to use the secondary disk + ln -s /mnt/bin ./bin + + echo "Android toolchain directories configured:" + ls -la /mnt + ls -la | grep bin + df -h /mnt + - name: Setup .NET uses: actions/setup-dotnet@v4 with: @@ -25,6 +46,11 @@ jobs: make jenkins PREPARE_CI=1 PREPARE_AUTOPROVISION=1 CONFIGURATION=Debug timeout-minutes: 60 + - name: Log disk space (after android build) + uses: ./.github/workflows/log-disk-space + with: + detailed: 'true' + - name: Upload logs uses: actions/upload-artifact@v4 if: steps.android-build.outcome == 'failure' diff --git a/.github/workflows/log-disk-space/action.yml b/.github/workflows/log-disk-space/action.yml new file mode 100644 index 00000000000..d3eb76143db --- /dev/null +++ b/.github/workflows/log-disk-space/action.yml @@ -0,0 +1,58 @@ +name: Log Disk Space +description: Logs disk space usage on the runner +inputs: + detailed: + description: 'Whether to include detailed disk analysis (true/false)' + required: false + default: 'false' +runs: + using: composite + steps: + - name: Display disk space + shell: bash + run: | + echo "=== Disk Space Usage ===" + df -h + echo "" + echo "=== Inode Usage ===" + df -i + echo "" + echo "=== Disk Usage Summary ===" + df -h / | tail -1 | awk '{print "Used: " $3 " / " $2 " (" $5 " full)"}' + + # Detailed analysis if requested + if [ "${{ inputs.detailed }}" = "true" ]; then + echo "" + echo "=== DETAILED ANALYSIS ===" + echo "" + echo "=== Largest directories in /home/runner ===" + sudo du -h /home/runner 2>/dev/null | sort -rh | head -20 + echo "" + echo "=== Largest directories in /opt ===" + sudo du -h /opt 2>/dev/null | sort -rh | head -20 + echo "" + echo "=== Workspace breakdown (top level) ===" + du -h --max-depth=1 . 2>/dev/null | sort -rh + echo "" + echo "=== Workspace breakdown (2 levels deep) ===" + du -h --max-depth=2 . 2>/dev/null | sort -rh | head -30 + echo "" + echo "=== bin directory ===" + du -sh ./bin/* 2>/dev/null | sort -rh | head -20 || echo "No bin" + echo "" + echo "=== external directory ===" + du -sh ./external/* 2>/dev/null | sort -rh | head -20 || echo "No external" + echo "" + echo "=== Android toolchain directories ===" + du -sh /mnt/android-archives 2>/dev/null || echo "No android-archives" + du -sh /mnt/android-toolchain 2>/dev/null || echo "No android-toolchain" + echo "" + echo "=== /mnt disk usage ===" + du -h --max-depth=1 /mnt 2>/dev/null | sort -rh + echo "" + echo "=== Docker usage ===" + docker system df 2>/dev/null || echo "Docker not available" + echo "" + echo "=== Temp directories ===" + du -sh /tmp /var/tmp 2>/dev/null || true + fi From 3ca0ea866a9d034627c645e9cb4bf11b770b3b58 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 5 Nov 2025 09:58:06 -0600 Subject: [PATCH 2/5] Update copilot-setup-steps.yml --- .github/workflows/copilot-setup-steps.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 7f2caaeb3d3..6422f2cd0f4 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -22,9 +22,12 @@ jobs: - name: Setup build directories on secondary disk run: | echo "Setting up Android toolchain on /mnt (secondary disk with 66G+ free)" - mkdir -p /mnt/android-archives - mkdir -p /mnt/android-toolchain - mkdir -p /mnt/bin + + # Create directories with sudo and set ownership + sudo mkdir -p /mnt/android-archives + sudo mkdir -p /mnt/android-toolchain + sudo mkdir -p /mnt/bin + sudo chown $USER:$USER /mnt/android-archives /mnt/android-toolchain /mnt/bin # Create symlink for bin to use the secondary disk ln -s /mnt/bin ./bin From 74b532050942e1ea8454c0a131bfe0bf9557dfff Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 5 Nov 2025 09:58:09 -0600 Subject: [PATCH 3/5] Update action.yml --- .github/workflows/log-disk-space/action.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/log-disk-space/action.yml b/.github/workflows/log-disk-space/action.yml index d3eb76143db..bab2b5c568a 100644 --- a/.github/workflows/log-disk-space/action.yml +++ b/.github/workflows/log-disk-space/action.yml @@ -19,6 +19,14 @@ runs: echo "" echo "=== Disk Usage Summary ===" df -h / | tail -1 | awk '{print "Used: " $3 " / " $2 " (" $5 " full)"}' + echo "" + echo "=== /mnt disk info ===" + echo "Permissions:" + ls -la / | grep mnt + echo "Contents:" + ls -la /mnt 2>/dev/null || echo "/mnt is empty or not accessible" + echo "Disk usage:" + df -h /mnt # Detailed analysis if requested if [ "${{ inputs.detailed }}" = "true" ]; then From 88a798bc1f700dfb3468d08d8204bd28f21bf033 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 5 Nov 2025 10:55:07 -0600 Subject: [PATCH 4/5] Update copilot-setup-steps.yml --- .github/workflows/copilot-setup-steps.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 6422f2cd0f4..6b1bb6a54ef 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -29,12 +29,13 @@ jobs: sudo mkdir -p /mnt/bin sudo chown $USER:$USER /mnt/android-archives /mnt/android-toolchain /mnt/bin - # Create symlink for bin to use the secondary disk + # Remove bin directory if it exists and create symlink to use the secondary disk + rm -rf ./bin ln -s /mnt/bin ./bin echo "Android toolchain directories configured:" ls -la /mnt - ls -la | grep bin + ls -lah bin df -h /mnt - name: Setup .NET From a721bdbc88f630a88ce66ecb4a3e7369dc962dd2 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 5 Nov 2025 12:20:22 -0600 Subject: [PATCH 5/5] Update action.yml --- .github/workflows/log-disk-space/action.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/log-disk-space/action.yml b/.github/workflows/log-disk-space/action.yml index bab2b5c568a..b44f7a7bfcc 100644 --- a/.github/workflows/log-disk-space/action.yml +++ b/.github/workflows/log-disk-space/action.yml @@ -11,6 +11,8 @@ runs: - name: Display disk space shell: bash run: | + MAX_LINES=20 + echo "=== Disk Space Usage ===" df -h echo "" @@ -34,29 +36,29 @@ runs: echo "=== DETAILED ANALYSIS ===" echo "" echo "=== Largest directories in /home/runner ===" - sudo du -h /home/runner 2>/dev/null | sort -rh | head -20 + sudo du -h /home/runner 2>/dev/null | sort -rh | head -$MAX_LINES || true echo "" echo "=== Largest directories in /opt ===" - sudo du -h /opt 2>/dev/null | sort -rh | head -20 + sudo du -h /opt 2>/dev/null | sort -rh | head -$MAX_LINES || true echo "" echo "=== Workspace breakdown (top level) ===" - du -h --max-depth=1 . 2>/dev/null | sort -rh + du -h --max-depth=1 . 2>/dev/null | sort -rh || true echo "" echo "=== Workspace breakdown (2 levels deep) ===" - du -h --max-depth=2 . 2>/dev/null | sort -rh | head -30 + du -h --max-depth=2 . 2>/dev/null | sort -rh | head -$MAX_LINES || true echo "" echo "=== bin directory ===" - du -sh ./bin/* 2>/dev/null | sort -rh | head -20 || echo "No bin" + du -sh ./bin/* 2>/dev/null | sort -rh | head -$MAX_LINES || echo "No bin" echo "" echo "=== external directory ===" - du -sh ./external/* 2>/dev/null | sort -rh | head -20 || echo "No external" + du -sh ./external/* 2>/dev/null | sort -rh | head -$MAX_LINES || echo "No external" echo "" echo "=== Android toolchain directories ===" du -sh /mnt/android-archives 2>/dev/null || echo "No android-archives" du -sh /mnt/android-toolchain 2>/dev/null || echo "No android-toolchain" echo "" echo "=== /mnt disk usage ===" - du -h --max-depth=1 /mnt 2>/dev/null | sort -rh + du -h --max-depth=1 /mnt 2>/dev/null | sort -rh || true echo "" echo "=== Docker usage ===" docker system df 2>/dev/null || echo "Docker not available"