Skip to content

Commit

Permalink
Clear disk space before release (#10775)
Browse files Browse the repository at this point in the history
Signed-off-by: Jenny Shu <[email protected]>
  • Loading branch information
jenshu authored Mar 7, 2025
1 parent 1cf50fd commit 07c0dfc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 18 deletions.
42 changes: 34 additions & 8 deletions .github/actions/prep-go-runner/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,45 @@ runs:
run: |
echo "Before clearing disk space:"
df -h
docker system df -v
# https://github.com/actions/virtual-environments/issues/709
sudo apt-get clean
# https://github.com/actions/runner-images/discussions/3242 github runners are bad at cleanup
echo "Removing large packages"
sudo apt-get remove -y '^dotnet-.*' || true
sudo apt-get remove -y '^llvm-.*' || true
sudo apt-get remove -y 'php.*' || true
sudo apt-get remove -y '^mongodb-.*' || true
sudo apt-get remove -y '^mysql-.*' || true
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri || true
sudo apt-get autoremove -y || true
sudo apt-get clean -y || true
echo "Done removing large packages"
# Clean up pre-installed tools
# https://github.com/actions/virtual-environments/issues/1918
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf $AGENT_TOOLSDIRECTORY
sudo rm -rf /usr/local/lib/android || true
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /usr/local/graalvm || true
sudo rm -rf /opt/ghc || true
sudo rm -rf /usr/local/.ghcup || true
sudo rm -rf /usr/local/share/boost || true
sudo rm -rf /usr/local/share/powershell || true
sudo rm -rf /usr/local/share/chromium || true
sudo rm -rf $AGENT_TOOLSDIRECTORY || true
# Clean up images
docker image rm node:16 || true
docker image rm node:16-alpine || true
docker image rm node:18 || true
docker image rm node:18-alpine || true
docker image rm node:20 || true
docker image rm node:20-alpine || true
# remove the dangling images and containers
docker images | tail -n +2 | awk '$1 == "<none>" {print $3}' | xargs --no-run-if-empty docker rmi
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $1}' | xargs --no-run-if-empty docker rm --volumes=true
echo "After clearing disk space:"
df -h
docker system df -v
- name: Set up Go
id: setup-go
uses: actions/setup-go@v5
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set the release related variables
id: set_vars
run: |
Expand Down Expand Up @@ -79,6 +78,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Prep Go Runner
uses: ./.github/actions/prep-go-runner

- name: Helm login to ${{ env.IMAGE_REGISTRY }}
if: ${{ github.event_name != 'pull_request' }}
run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ${{ env.IMAGE_REGISTRY }} -u ${{ github.repository_owner }} --password-stdin
Expand All @@ -105,11 +107,8 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- name: Prep Go Runner
uses: ./.github/actions/prep-go-runner

# We publish a rolling main release for every commit to main. Deleting the release
# ensures that the tagged commit is not stale. Goreleaser will create a new tag
Expand Down Expand Up @@ -151,10 +150,8 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Prep Go Runner
uses: ./.github/actions/prep-go-runner

- name: Login to ghcr.io
if: ${{ github.event_name != 'pull_request' }}
Expand Down

0 comments on commit 07c0dfc

Please sign in to comment.