[CI]: Stabilize Github Disk Action #2543
Conversation
Signed-off-by: Samuel Shen <slshen@uchciago.edu>
Summary of ChangesHello @sammshen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the stability and efficiency of the GitHub Action responsible for freeing disk space on CI runners. It addresses potential issues arising from GitHub Runner updates by making cleanup operations more robust, switching to standard and more reliable package management commands, and expanding the scope of manual file deletions to reclaim more disk space. These changes aim to prevent CI failures related to disk space and improve the overall reliability of the build process. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request aims to stabilize the disk space cleanup action by replacing aptitude with apt-get, adding || true to all commands to prevent failures, and including more items in the cleanup list. The changes are solid and well-reasoned. I've provided one suggestion to further improve the script's robustness and effectiveness by making error messages visible for easier debugging and by using a more comprehensive Docker cleanup command.
| run: | | ||
| sudo docker rmi "$(docker image ls -aq)" >/dev/null 2>&1 || true | ||
| sudo rm -rf \ | ||
| /usr/share/dotnet /usr/local/lib/android /opt/ghc \ | ||
| /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \ | ||
| /usr/lib/jvm || true | ||
| sudo apt install aptitude -y >/dev/null 2>&1 | ||
| sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1 | ||
| sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1 | ||
| sudo apt-get autoremove -y >/dev/null 2>&1 | ||
| sudo apt-get autoclean -y >/dev/null 2>&1 | ||
| # 1. Remove massive toolsets first (fastest gain) | ||
| sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup /usr/lib/jvm /usr/local/lib/node_modules || true | ||
|
|
||
| # 2. Clean Docker images | ||
| sudo docker image prune -af >/dev/null 2>&1 || true | ||
|
|
||
| # 3. Clean APT (Skip aptitude, use standard apt-get) | ||
| # We wrap this in a block to ensure the script continues even if apt is locked | ||
| sudo apt-get update >/dev/null 2>&1 || true | ||
| sudo apt-get purge -y mysql-client mysql-server google-cloud-sdk azure-cli >/dev/null 2>&1 || true | ||
| sudo apt-get autoremove -y >/dev/null 2>&1 || true | ||
| sudo apt-get clean >/dev/null 2>&1 || true | ||
| shell: bash |
There was a problem hiding this comment.
This script is a great improvement for stabilizing the disk cleanup. I have a couple of suggestions to make it even more robust and effective:
-
Improve Debuggability: Redirecting both stdout and stderr (
>/dev/null 2>&1) hides all output, including errors. This can make troubleshooting difficult. By only redirecting stdout (>/dev/null), you can keep the logs clean from verbose output while still seeing any errors that might occur. -
More Thorough Docker Cleanup:
docker image pruneonly cleans up images. To free up more space, you could usedocker system prune -af. This command is more comprehensive and removes stopped containers, unused networks, and build cache in addition to unused images.
run: |
# 1. Remove massive toolsets first (fastest gain)
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup /usr/lib/jvm /usr/local/lib/node_modules || true
# 2. Clean Docker images and other Docker resources
sudo docker system prune -af >/dev/null || true
# 3. Clean APT (Skip aptitude, use standard apt-get)
# We wrap this in a block to ensure the script continues even if apt is locked
sudo apt-get update >/dev/null || true
sudo apt-get purge -y mysql-client mysql-server google-cloud-sdk azure-cli >/dev/null || true
sudo apt-get autoremove -y >/dev/null || true
sudo apt-get clean >/dev/null || true
shell: bashskip apt-get Signed-off-by: Samuel Shen <slshen@uchciago.edu> Co-authored-by: Samuel Shen <slshen@uchciago.edu>
skip apt-get Signed-off-by: Samuel Shen <slshen@uchciago.edu> Co-authored-by: Samuel Shen <slshen@uchciago.edu>
skip apt-get Signed-off-by: Samuel Shen <slshen@uchciago.edu> Co-authored-by: Samuel Shen <slshen@uchciago.edu> Signed-off-by: shaoxiawjc <wjc2800@163.com>
Replaced
aptitudewith standardapt-getfor package removal.Added
|| trueto all cleanup commands.Added a quick
apt-get updateto ensure package lists are valid before purging.Included
/usr/local/lib/node_modulesin the manual deletion list.This was likely caused by a recent update to the GitHub Runner's Ubuntu image, which created dependency conflicts that
aptitudecouldn't resolve automatically.