Skip to content

build: fix disk space exhaustion in release builds#10306

Merged
Roasbeef merged 3 commits intolightningnetwork:masterfrom
Roasbeef:free-release-space
Oct 21, 2025
Merged

build: fix disk space exhaustion in release builds#10306
Roasbeef merged 3 commits intolightningnetwork:masterfrom
Roasbeef:free-release-space

Conversation

@Roasbeef
Copy link
Member

This PR aims to fix an issue that caused the last release build to fail: running out of disk space before the final platform is built.

We do a few things to attempt to reduce disk space:

  • Remove more unneeded directories in the clean up space action.
  • Use the clean up space action in the release build.
  • Clear the go cache between platform builds.

@Roasbeef Roasbeef added enhancement Improvements to existing features / behaviour releases labels Oct 20, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @Roasbeef, 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 addresses critical disk space exhaustion issues that have previously caused release build failures. It introduces a more comprehensive cleanup strategy within the GitHub Actions workflow, including the removal of additional large toolsets and caches, and integrates a step to clear the Go build cache between platform builds. These changes aim to ensure more stable and successful release processes by optimizing disk usage.

Highlights

  • Enhanced Disk Space Cleanup: The GitHub Actions cleanup script has been significantly expanded to remove a wider range of unnecessary files, toolsets, Docker images, and caches, including Swift, Julia, hosted tool caches, various apt packages, and more.
  • Go Build Cache Management: The release script now explicitly clears the Go build cache (go clean -cache) after each platform build to prevent accumulation of temporary files and mitigate disk space issues during multi-platform builds.
  • Release Candidate Version Update: The application's pre-release version has been incremented from "beta.rc1" to "beta.rc2" in build/version.go.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/release.yaml
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

@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 introduces several changes to mitigate disk space exhaustion during release builds. The main strategies are to enhance the cleanup-space action with more aggressive cleaning of packages, caches, and Docker images, and to clear the Go build cache between building for different platforms. The changes are logical and should be effective. I've added a couple of suggestions to the cleanup-space action to use more modern commands and remove a redundant step, which will make the script cleaner and more robust.

@Roasbeef Roasbeef requested review from a team, bhandras and bitromortac and removed request for a team October 20, 2025 21:39
In this commit, we significantly expand the cleanup-space GitHub Actions
workflow to free up substantially more disk space on GitHub runners. The
previous cleanup only removed three large toolsets (dotnet, android,
ghc), which should free ~14GB. This enhancement adds removal of several
additional large packages and caches, bringing the total freed space to
approximately 20-25GB.

The specific additions include removing Swift and Julia language runtimes,
the hosted toolcache directory, all Docker images, numerous large apt
packages (aspnetcore, llvm, php, mongodb, mysql, azure-cli, browsers, and
development tools), and various cache directories. We also add disk space
reporting before and after cleanup to provide visibility into how much
space is actually being freed during workflow runs.

This enhancement was motivated by release builds running out of disk space
when building for all 15 supported platforms (darwin, freebsd, linux,
netbsd, openbsd, windows across multiple architectures). The sequential
builds with verbose output were consuming more space than the basic cleanup
could provide.
In this commit, we replace the basic inline cleanup command in the release
workflow with the comprehensive cleanup-space action that was previously
only used in the main CI workflow. The previous release workflow cleanup
simply removed the hostedtoolcache directory, which freed only a few
gigabytes and proved insufficient for multi-platform release builds.

By switching to the cleanup-space action (now enhanced to free 20-25GB),
the release workflow will have substantially more disk space available
before beginning the build process. This should resolve the disk space
exhaustion issues that were occurring during the Windows ARM build phase,
which is one of the final platforms in the 15-platform build sequence.
In this commit, we add a call to "go clean -cache" after each platform
build in the release script to prevent the Go build cache from accumulating
unbounded disk space during the sequential 15-platform build process.

When building for multiple platforms in sequence with "go build -v", Go
creates intermediate build artifacts and caches compiled packages for each
target platform. While this caching improves build performance within a
single platform build, it causes the cache to grow substantially when
building for many platforms sequentially. With 15 different platform/
architecture combinations, each with their own cached artifacts, this
accumulation was contributing to the disk space exhaustion.

By clearing the build cache after each platform completes, we prevent this
unbounded growth while still allowing each individual platform build to
benefit from caching during its own compilation. The module cache is
preserved (we only clear the build cache), so dependencies don't need to be
re-downloaded between platforms.
Copy link
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

sudo rm -rf /opt/ghc
# Remove large packages.
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/local/julia*
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these things really on the runner?

@saubyk saubyk added this to lnd v0.20 Oct 21, 2025
@saubyk saubyk moved this to In review in lnd v0.20 Oct 21, 2025
@Roasbeef Roasbeef merged commit 8e75ef0 into lightningnetwork:master Oct 21, 2025
68 of 73 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in lnd v0.20 Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvements to existing features / behaviour no-changelog releases

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants