Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ jobs:
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: ./tools/github-actions/setup-deps
- uses: ./tools/github-actions/reclaim-storage

- name: Download EG Binaries
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
Expand Down
8 changes: 8 additions & 0 deletions tools/github-actions/reclaim-storage/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: reclaim-storage
description: Remove unnecessary packages and artifacts from GitHub Actions Runner

runs:
using: composite
steps:
- shell: bash
run: make reclaim-storage
42 changes: 42 additions & 0 deletions tools/hack/reclaim-storage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail

log() { echo "==> $*"; }

log "Initial disk usage:"
df -h || true

# Remove large, unused language/tool runtimes
TO_DELETE=(
/usr/local/lib/android
/usr/share/dotnet
/opt/ghc
/usr/local/.ghcup
/usr/share/swift
Comment on lines +11 to +15
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shreealt Is there a reference somewhere for the dirs being removed here or a list of others we may want to consider?
The release pipeline is still failing with disk space errors so wondering if we need to add more - https://github.com/envoyproxy/gateway/actions/runs/19566911461

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @jukie I have raised #7587 to fix this.

)

for path in "${TO_DELETE[@]}"; do
if [ -d "$path" ]; then
log "Removing $path"
sudo rm -rf "$path"
fi
done

log "Removing large packages..."
EXTRA_PKGS="azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri google-cloud-sdk google-cloud-cli"

sudo apt-get remove -y "$EXTRA_PKGS" --fix-missing || true
sudo apt-get autoremove -y || true
sudo apt-get clean || true

# Swap removal
if [ -f /mnt/swapfile ]; then
log "Disabling and removing swapfile"
sudo swapoff -a || true
sudo rm -f /mnt/swapfile || true
fi

log "Final disk usage:"
df -h || true

log "Completed disk space reclamation."
4 changes: 4 additions & 0 deletions tools/make/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ tools.clean: # Remove all tools
.PHONY: clean
clean: ## Remove all files that are created during builds.
clean: tools.clean

.PHONY: reclaim-storage
reclaim-storage: ## Removes unnecessary packages and artifacts from GitHub Actions Runner
bash ./tools/hack/reclaim-storage.sh