Path: blob/trunk/scripts/github-actions/free-disk-space.sh
2867 views
#!/usr/bin/env bash1# Licensed to the Apache Software Foundation (ASF) under one or more2# contributor license agreements. See the NOTICE file distributed with3# this work for additional information regarding copyright ownership.4# The ASF licenses this file to You under the Apache License, Version 2.05# (the "License"); you may not use this file except in compliance with6# the License. You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.151617#18# The Azure provided machines typically have the following disk allocation:19# Total space: 85GB20# Allocated: 67 GB21# Free: 17 GB22# This script frees up 28 GB of disk space by deleting unneeded packages and23# large directories.24# The Flink end to end tests download and generate more than 17 GB of files,25# causing unpredictable behavior and build failures.26#27echo "=============================================================================="28echo "Freeing up disk space on CI system"29echo "=============================================================================="3031echo "Listing 100 largest packages"32dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 10033df -h34echo "Removing large packages"35sudo apt-get remove -y '^dotnet-.*'36sudo apt-get remove -y '^llvm-.*'37sudo apt-get remove -y 'php.*'38sudo apt-get remove -y '^mongodb-.*'39sudo apt-get remove -y '^mysql-.*'40sudo apt-get remove -y azure-cli google-cloud-sdk hhvm powershell mono-devel libgl1-mesa-dri41sudo apt-get autoremove -y42sudo apt-get clean43df -h4445echo "Removing large directories"4647sudo rm -rf /usr/share/dotnet/48sudo rm -rf /usr/local/graalvm/49sudo rm -rf /usr/local/.ghcup/50sudo rm -rf /usr/local/share/powershell51# sudo rm -rf /usr/local/share/chromium52sudo rm -rf /usr/local/lib/android53# sudo rm -rf /usr/local/lib/node_modules54df -h555657