Skip to content

ci: free disk space before CI jobs - #25

Merged
antas-marcin merged 1 commit into
mainfrom
pipeline-cleanup-runner-action
Dec 4, 2026
Merged

antas-marcin merged 1 commit into
mainfrom
pipeline-cleanup-runner-action

Conversation

@antas-marcin

@antas-marcin antas-marcin commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Frees disk space on the CI runners before the image builds, and stops shipping pip's download cache inside the Docker images.

Free Disk Space action

Adds a local composite action, .github/actions/free-disk-space, and runs it right after checkout in both build jobs (build-image and build-custom-image). gh-release is skipped because it doesn't check out the repo.

Both jobs run on GitHub's Ubuntu 26.04 x64 image. The jobs only need git, Docker/buildx and the Python 3.11 that setup-python takes from the tool cache, so the action deletes toolchains they never use:

  • insightsengineering/disk-space-reclaimer removes the Android SDK and .NET. haskell is off because the reclaimer only deletes /opt/ghc, which 26.04 doesn't have.
  • A plain rm -rf step removes GHCup, Swift, the JDKs, PowerShell/Edge, Azure and Google Cloud CLIs, Chrome/Chromium, Rust, Homebrew, vcpkg, and CodeQL/PyPy/Go/Node/Ruby from the tool cache. It's much faster than the apt-based large-packages option.
  • Kept: the Python tool cache (used by setup-python), swap (build-image loads bge-reranker-v2-m3), and the apt-installed compilers and databases (removing them takes minutes).

This mostly helps build-custom-image, which runs on standard ubuntu-latest. On tag builds it builds the image once locally, then again for amd64 and arm64 with buildx. build-image already runs on 4-core larger runners, which have more disk.

--no-cache-dir in the Dockerfiles

Dockerfile and custom.Dockerfile ran pip install without --no-cache-dir, leaving a 3.1 GB pip download cache (/root/.cache/pip) in every image. Both pip steps now skip the cache. In a local arm64 build with ms-marco-TinyBERT-L-2-v2, the image went from 9.67 GB to 6.38 GB, and the smoke tests pass. This makes the published images about 3 GB smaller per architecture.

Verify on this PR's run

The reclaimer step logs df before and after, and the new step prints df -h / at the end, so this PR's CI run shows how much space is actually freed.

@antas-marcin
antas-marcin requested a review from a team as a code owner December 4, 2026 13:10

@orca-security-eu orca-security-eu Bot 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.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 1   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca
🛡️ The following IaC misconfigurations have been detected
NAME FILE
low Pip Install Without Pinned Package Version Dockerfile View in code

@antas-marcin
antas-marcin merged commit 2b4b304 into main Dec 4, 2026
9 checks passed
@antas-marcin
antas-marcin deleted the pipeline-cleanup-runner-action branch December 4, 2026 13:20
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.

1 participant