|
| 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 | +# Taken from https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh |
| 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 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 | +sudo rm -rf /usr/local/lib/node_modules |
| 54 | +df -h |
0 commit comments