Skip to content

CI: reusable_build: implement HACK to freeup some space in Host Image#81

Merged
robimarko merged 1 commit intoopenwrt:mainfrom
Ansuel:delete-stuff
Jan 15, 2026
Merged

CI: reusable_build: implement HACK to freeup some space in Host Image#81
robimarko merged 1 commit intoopenwrt:mainfrom
Ansuel:delete-stuff

Conversation

@Ansuel
Copy link
Member

@Ansuel Ansuel commented Jan 14, 2026

Implement an HACK to freeup some space in the Github Host Image.

It was discovered that lots of space is wasted by all the dependency installed by default in the ubuntu-latest image and it's not possible to delete them when the workflow is run directly with a container image.

To handle this we run the container in privileged mode and assing the same pid of the host machine.

This way with the help of the nsenter command and some magic/reverse of the Github Action shell variable, we can execute command directly in the host machine permiting to delete all kind of unwanted files.

This permits to gain extra space of about 20+ GB by removing Android Swift and dotnet files.

We use rsync with the empty directory to speed up deletion of all these files (normal rm takes 2 minutes with rsync taking max 30-40 seconds)

Implement an HACK to freeup some space in the Github Host Image.

It was discovered that lots of space is wasted by all the dependency
installed by default in the ubuntu-latest image and it's not possible to
delete them when the workflow is run directly with a container image.

To handle this we run the container in privileged mode and assing the
same pid of the host machine.

This way with the help of the nsenter command and some magic/reverse of
the Github Action shell variable, we can execute command directly in the
host machine permiting to delete all kind of unwanted files.

This permits to gain extra space of about 20+ GB by removing Android
Swift and dotnet files.

We use rsync with the empty directory to speed up deletion of all these
files (normal rm takes 2 minutes with rsync taking max 30-40 seconds)

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
@github-actions
Copy link

Warning

Some formality checks failed.

Consider (re)reading submissions guidelines.

Failed checks

Issues marked with an ❌ are failing checks.

Commit 53722a8

  • ❌ Commit subject length: recommended max 50, required max 60 characters

For more details, see the full job log.

Something broken? Consider providing feedback.

@aparcar
Copy link
Member

aparcar commented Jan 15, 2026

Nice combination of hacks

@robimarko robimarko merged commit 6ce96dd into openwrt:main Jan 15, 2026
1 check failed
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