Skip to content

Commit ce902ec

Browse files
authored
Add script to remove additional tooling that is not needed (#2397)
1 parent e001c8d commit ce902ec

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

.github/workflows/pull_request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
go-version: 1.24.9
4646
- name: Fetch all tags
4747
run: git fetch --force --tags
48+
- name: Free disk space
49+
run: bash ${GITHUB_WORKSPACE}/scripts/free_disk_space.sh
4850
- name: Get dependencies
4951
env:
5052
KIND_VER: "v0.29.0"

.github/workflows/release.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
fetch-depth: 0
4141
- name: Fetch all tags
4242
run: git fetch --force --tags
43+
- name: Free disk space
44+
run: bash ${GITHUB_WORKSPACE}/scripts/free_disk_space.sh
4345
- name: Set up Go
4446
uses: actions/setup-go@v4
4547
with:

scripts/free_disk_space.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
# There are multiple reports of low free disk space and the suggestion is always to remove pre-installed software
19+
# https://github.com/actions/runner-images/issues/2875
20+
21+
# Source: https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh
22+
23+
#
24+
# The Azure provided machines typically have the following disk allocation:
25+
# Total space: 85GB
26+
# Allocated: 67 GB
27+
# Free: 17 GB
28+
# This script frees up 28 GB of disk space by deleting unneeded packages and
29+
# large directories.
30+
# The Flink end to end tests download and generate more than 17 GB of files,
31+
# causing unpredictable behavior and build failures.
32+
#
33+
echo "=============================================================================="
34+
echo "Freeing up disk space on CI system"
35+
echo "=============================================================================="
36+
37+
echo "Listing 100 largest packages"
38+
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
39+
df -h
40+
echo "Removing large packages"
41+
sudo apt-get remove -y '^dotnet-.*'
42+
sudo apt-get remove -y '^llvm-.*'
43+
sudo apt-get remove -y 'php.*'
44+
sudo apt-get remove -y '^mongodb-.*'
45+
sudo apt-get remove -y '^mysql-.*'
46+
sudo apt-get remove -y azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri
47+
sudo apt-get autoremove -y
48+
sudo apt-get clean
49+
df -h
50+
echo "Removing large directories"
51+
52+
sudo rm -rf /usr/share/dotnet/
53+
sudo rm -rf /usr/local/graalvm/
54+
sudo rm -rf /usr/local/.ghcup/
55+
sudo rm -rf /usr/local/share/powershell
56+
sudo rm -rf /usr/local/share/chromium
57+
sudo rm -rf /usr/local/lib/android
58+
sudo rm -rf /usr/local/lib/node_modules
59+
df -h

0 commit comments

Comments
 (0)