Skip to content

[CI]: Stabilize Github Disk Action #2543

Merged
kobe0938 merged 1 commit intoLMCache:devfrom
sammshen:cleanup-disk-action
Feb 5, 2026
Merged

[CI]: Stabilize Github Disk Action #2543
kobe0938 merged 1 commit intoLMCache:devfrom
sammshen:cleanup-disk-action

Conversation

@sammshen
Copy link
Copy Markdown
Contributor

@sammshen sammshen commented Feb 5, 2026

  • Replaced aptitude with standard apt-get for package removal.

  • Added || true to all cleanup commands.

  • Added a quick apt-get update to ensure package lists are valid before purging.

  • Included /usr/local/lib/node_modules in the manual deletion list.

This was likely caused by a recent update to the GitHub Runner's Ubuntu image, which created dependency conflicts that aptitude couldn't resolve automatically.

Signed-off-by: Samuel Shen <slshen@uchciago.edu>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • Enhanced Robustness: All cleanup commands now include || true to ensure the action continues execution even if a specific cleanup step fails, preventing build interruptions.
  • Improved APT Package Management: The action now uses standard apt-get commands instead of aptitude for package purging. It includes an apt-get update step for valid package lists and targets specific packages like mysql-client, mysql-server, google-cloud-sdk, and azure-cli for removal.
  • Optimized Docker Cleanup: The method for cleaning Docker images has been updated from sudo docker rmi "$(docker image ls -aq)" to the more efficient sudo docker image prune -af.
  • Expanded Manual Deletion: The /usr/local/lib/node_modules directory has been added to the list of paths manually removed, reclaiming additional disk space on the runner.
  • Action Description Update: The action's description has been updated to 'Frees disk space on the runner safely', reflecting the improvements in reliability.

🧠 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
  • .github/actions/free-disk-space/action.yml
    • Updated the action's description from 'Frees disk space on the runner' to 'Frees disk space on the runner safely'.
    • Modified the Free Disk Space Linux step to include || true for all sudo commands, enhancing fault tolerance.
    • Added /usr/local/lib/node_modules to the rm -rf command for manual directory cleanup.
    • Replaced sudo docker rmi "$(docker image ls -aq)" with sudo docker image prune -af for Docker image cleanup.
    • Removed sudo apt install aptitude -y and sudo aptitude purge commands.
    • Introduced sudo apt-get update >/dev/null 2>&1 || true before package purging.
    • Changed sudo aptitude purge '~n ^mysql' -f -y and sudo aptitude purge '~n ^dotnet' -f -y to sudo apt-get purge -y mysql-client mysql-server google-cloud-sdk azure-cli.
    • Added || true to sudo apt-get autoremove and sudo apt-get clean commands.
    • Simplified the df -h commands by removing the | pipe for single command execution.
Activity
  • No specific review comments or human activity have been recorded on this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 12 to 25
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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:

  1. 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.

  2. More Thorough Docker Cleanup: docker image prune only cleans up images. To free up more space, you could use docker 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: bash

@kobe0938 kobe0938 enabled auto-merge (squash) February 5, 2026 00:25
@github-actions github-actions Bot added the full Run comprehensive tests on this PR label Feb 5, 2026
Copy link
Copy Markdown
Contributor

@ApostaC ApostaC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kobe0938 kobe0938 merged commit 7657f30 into LMCache:dev Feb 5, 2026
21 checks passed
DongDongJu pushed a commit to DongDongJu/LMCache that referenced this pull request Feb 22, 2026
skip apt-get

Signed-off-by: Samuel Shen <slshen@uchciago.edu>
Co-authored-by: Samuel Shen <slshen@uchciago.edu>
sammshen added a commit to sammshen/LMCache that referenced this pull request Mar 1, 2026
skip apt-get

Signed-off-by: Samuel Shen <slshen@uchciago.edu>
Co-authored-by: Samuel Shen <slshen@uchciago.edu>
shaoxiawjc pushed a commit to shaoxiawjc/LMCache that referenced this pull request Mar 11, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full Run comprehensive tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants