-
Notifications
You must be signed in to change notification settings - Fork 5.5k
fix(ci): Free disk space action #26318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ci): Free disk space action #26318
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdate the Linux build workflow to mount host directories into the CI container and replace the external disk-cleanup action with a custom inline script that calculates available space and removes specific host paths. Flow diagram for custom disk cleanup script in CIflowchart TD
Start["Start CI job in container"] --> Mount["Mount /usr as /host_usr and /opt as /host_opt"]
Mount --> Script["Run custom disk cleanup script"]
Script --> CheckSpaceBefore["Check available disk space (before)"]
CheckSpaceBefore --> RemoveDotNet["Remove /host_usr/share/dotnet"]
RemoveDotNet --> RemoveAndroid["Remove /host_usr/local/lib/android"]
RemoveAndroid --> RemoveCodeQL["Remove /host_opt/hostedtoolcache/CodeQL"]
RemoveCodeQL --> CheckSpaceAfter["Check available disk space (after)"]
CheckSpaceAfter --> End["Continue build steps"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
76a0513
to
1d97474
Compare
The previous github action used did not work. The reason is that it was run inside the (dependency) container where the commands did not run (sudo not found) as well as the files to be deleted were not present. This fix mounts the host path that contains the files to be deleted into the container and we can run custom commands to clean up disk space. The free-disk-space action uses sudo to remove packages that are not needed. However, sudo is not found and as a result does not clean up any disk space
@tdcmeehan FYI. This is fixing the disk space issues for this job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review: ## Individual Comments ### Comment 1 <location> `.github/workflows/prestocpp-linux-build.yml:69-71` </location> <code_context> - swap-storage: false + run: | + # Re-used from free-disk-space github action. + getAvailableSpace() { echo $(df -a 1ドル | awk 'NR > 1 {avail+=4ドル} END {print avail}'); } + # Show before + echo "Original available disk space: " $(getAvailableSpace) + # Remove DotNet. + rm -rf /host_usr/share/dotnet || true </code_context> <issue_to_address> **suggestion (bug_risk):** The getAvailableSpace function does not specify a path argument, which may lead to ambiguous disk space reporting. Calling getAvailableSpace without a path may report disk space for the root filesystem, which could be inaccurate if other mount points are affected. Specify the intended path when invoking the function. Suggested implementation: ``` # Show before echo "Original available disk space: " $(getAvailableSpace /host_usr) ``` ``` # Show after echo "New available disk space: " $(getAvailableSpace /host_usr) ``` </issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): The getAvailableSpace function does not specify a path argument, which may lead to ambiguous disk space reporting.
Calling getAvailableSpace without a path may report disk space for the root filesystem, which could be inaccurate if other mount points are affected. Specify the intended path when invoking the function.
Suggested implementation:
# Show before
echo "Original available disk space: " $(getAvailableSpace /host_usr)
# Show after
echo "New available disk space: " $(getAvailableSpace /host_usr)
1d97474
to
b061ce1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @czentgr
Thanks for the fix @czentgr .
9108a9a
into
prestodb:master
Uh oh!
There was an error while loading. Please reload this page.
The previous github action used did not work.
The reason is that it was run inside the
(dependency) container where the commands
did not run (sudo not found) as well as the
files to be deleted were not present.
This fix mounts the host path that contains the
files to be deleted into the container and
we can run custom commands to clean up disk
space.
Description
Motivation and Context
Impact
Test Plan
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.