Skip to content

fix(ci): add Linux host disk cleanup for CI builds - #1057

Merged
agneszitte merged 3 commits into
mainfrom
dev/agzi/ci-linux-host-cleanup
Mar 30, 2026
Merged

agneszitte merged 3 commits into
mainfrom
dev/agzi/ci-linux-host-cleanup

Conversation

@agneszitte

@agneszitte agneszitte commented Mar 29, 2026 •

Copy link
Copy Markdown
Member

What

Adds a Linux host disk cleanup step to all Linux CI jobs to reclaim disk space by removing unused pre-installed software.

Why

Linux CI agents accumulate ~20–30 GB of pre-installed software (Cargo, Rust, Swift, Edge, GHC, Mono, Android SDK, CodeQL, snapd) that is not needed for builds. This cleanup step runs at the start of each Linux job to ensure sufficient disk space.

Details

  • Adds a shared shell script (host-cleanup-linux.sh) called by both the AzDO template and GHA composite action
  • Cleanup is conditional on Linux (condition: eq(variables['Agent.OS'], 'Linux') / if: runner.os == 'Linux')
  • Uses sudo -n (non-interactive) probe to work safely in both host and container environments
  • All removals are best-effort (|| true) with timeout guards on snap/apt-get commands
  • Uses DEBIAN_FRONTEND=noninteractive for apt-get to prevent dpkg prompts

Part of org-wide CI disk cleanup initiative.
Related to https://github.com/unoplatform/uno.rider/pull/480

Copilot AI review requested due to automatic review settings March 29, 2026 17:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a reusable “host cleanup” step for Linux CI to reduce disk usage and avoid build failures caused by running out of space on hosted runners.

Changes:

  • Added an Azure DevOps template to remove unused SDK/toolchain directories and some snap packages on Linux.
  • Wired the AzDO cleanup template into both Linux test jobs.
  • Added a GitHub Actions composite action for the same cleanup and invoked it from the main CI workflow.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
build/ci/host-cleanup-linux.yml New AzDO cleanup template that removes preinstalled toolchains/SDKs to free disk space.
build/ci/stage-build-linux-tests.yml Calls the new cleanup template in both Linux jobs.
.github/actions/host-cleanup-linux/action.yml New GHA composite action implementing the Linux cleanup commands.
.github/workflows/ci.yml Adds a step to run the new cleanup composite action before .NET setup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread build/ci/host-cleanup-linux.yml Resolved
- Extract host-cleanup-linux.sh shared script used by both AzDO and GHA
- Use conditional sudo for container compatibility
- Use apt-get purge instead of apt remove
- Use rm -rf consistently
- Add || true on all sudo lines for best-effort cleanup
@agneszitte agneszitte changed the title ci: add Linux host disk cleanup for CI builds fix(ci): add Linux host disk cleanup for CI builds Mar 29, 2026
@agneszitte
agneszitte requested a review from Copilot March 29, 2026 18:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread build/ci/scripts/host-cleanup-linux.sh Resolved
Comment thread build/ci/stage-build-linux-tests.yml Resolved
Comment thread .github/workflows/ci.yml Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml Resolved

@kazo0 kazo0 left a comment

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.

Approved

@agneszitte
agneszitte merged commit 22395db into main Mar 30, 2026
15 of 16 checks passed
@agneszitte
agneszitte deleted the dev/agzi/ci-linux-host-cleanup branch March 30, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants