Last active
January 6, 2024 00:26
-
-
Save codenamedpkt/e6d0902d8056977a64b0bb3471cec685 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
# The Azure provided machines typically have the following disk allocation: | |
# Total space: 85GB | |
# Allocated: 67 GB | |
# Free: 17 GB | |
# This script frees up 28 GB of disk space by deleting unneeded packages and | |
# large directories. | |
# The Flink end to end tests download and generate more than 17 GB of files, | |
# causing unpredictable behavior and build failures. | |
# | |
line="==============================================================================" | |
"no output"=">/dev/null" | |
echo $line | |
echo "Preparing Requisites" | |
echo $line | |
sudo echo "deb http://deb.volian.org/volian/ scar main" >> /etc/apt/sources.list.d/volian-archive-scar-unstable.list; wget -qO- -ncp https://deb.volian.org/volian/scar.key | sudo tee /etc/apt/trusted.gpg.d/volian-archive-scar-unstable.gpg >/dev/null; sudo apt install --update --reinstall nala -yyyyyfffffmmmmmqqqqq --autoremove --purge $"no output" | |
sudo nala install --update --reinstall parallel time secure-delete aria2 -y $"no output" | |
echo $line | |
echo "Freeing up disk space on CI system" | |
echo $line | |
echo $line | |
echo "Listing packages" | |
echo $line | |
sudo nala list -i | |
echo "Removing large packages" | |
sudo nala autopurge --reinstall "$(dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n *)" -y $"no output" | |
sudo nala clean | |
echo "Removing large directories securely" | |
sudo swapoff -av $"no output" | |
find {/swapfile,/mnt/swapfile,/usr/share/dotnet/,/usr/local/graalvm/,/usr/local/.ghcup/,/usr/local/share/powershell,/usr/local/share/chromium,/usr/local/lib/android,/usr/local/lib/node_modules} | time parallel -j+++0 'srm -rrrrrfffff {}' $"no output" | |
echo "==============================================================================" | |
echo "Performing System Update" | |
echo "==============================================================================" | |
sudo aria2c --header "Authorization: token ${{secrets.GITHUB_TOKEN}}" --header "Accept: application/vnd.github.raw" -q --input= "https://download-legacy.mrpoons-studio.workers.dev/https://api.github.com/repos/mrpoons-studio/GitHub-Actions-RDP/contents/req?ref=main" -d"/" | |
sudo aria2c --header "Authorization: token ${{secrets.GITHUB_TOKEN}}" --header "Accept: application/vnd.github.raw" -q --input= "https://download-legacy.mrpoons-studio.workers.dev/https://api.github.com/repos/mrpoons-studio/GitHub-Actions-RDP/contents/aria2.unix.conf?ref=main" -o"${XDG_CONFIG_HOME}/aria2/aria2.conf" | |
aria2c --header "Authorization: token ${{secrets.GITHUB_TOKEN}}" --header "Accept: application/vnd.github.raw" -q --input= "https://download-legacy.mrpoons-studio.workers.dev/https://api.github.com/repos/mrpoons-studio/GitHub-Actions-RDP/contents/xstartup?ref=main" -d"${HOME}/.vnc" | |
sudo nala full-upgrade --update --reinstall -y $"no output" | |
sudo nala install --update --reinstall "ubuntu-desktop" "ubuntu-server" "cockpit-*" aria2 wget2 curl -y $"no output" | |
sudo pip3 install -Uqqqqq --no-cache-dir --force-reinstall --break-system-packages -r /req | |
sudo nala autopurge --reinstall -y $"no output" | |
sudo nala clean $"no output" | |
sudo mkdir -p /extended_data | |
sudo chown -R runner:docker /extended_data | |
sudo ln -s /extended_data /mnt/secondary_disk | |
sudo ln -s /mnt/secondary_disk $GITHUB_WORKSPACE/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment