Skip to content

Commit e1ba8e4

Browse files
committed
Fix for freeing disk space in CI/CD
Signed-off-by: Tim Messing <141575989+timmyteo@users.noreply.github.com>
1 parent 6ab2ed9 commit e1ba8e4

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ jobs:
3030
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
3131
restore-keys: |
3232
${{ runner.os }}-go-
33+
- name: Trim CI agent
34+
run: |
35+
chmod +x contrib/free_disk_space.sh
36+
./contrib/free_disk_space.sh
3337
- name: Build
3438
run: |
3539
wget https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-amd64_linux.tar.xz

contrib/free_disk_space.sh

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

0 commit comments

Comments
 (0)