Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@inFocus7
Copy link
Contributor

@inFocus7 inFocus7 commented Nov 17, 2025

Changes

  • Add reusable environment cleanup action.
  • Clean up environment before running CI to avoid - or at least lessen - space issues.
  • Added uv + apt-get cache cleanup.
    • May not be necessary with the environment cleanups, but couldn't be too cleared of cache.

Context

I have recently seen instances (1, 2, +2 others), where test-e2e is failing when setting up the test agents, since it runs out of space during a build. this PR is meant to hopefully completely mitigate that by clearing up space.

Note(s)

The cleanup action is lifted from kgateway go prep action, without the additional setup there, since this PR is currently focused on clearing space before before running workflows. This is similar to others actions in solo(org)-managed products, so it's a pattern followed.

Before & After

Before clearing disk space:
Filesystem Size Used Avail Use% Mounted on
/dev/root 72G 53G 19G 74% /
tmpfs 7.9G 84K 7.9G 1% /dev/shm
tmpfs 3.2G 1.1M 3.2G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sdb16 881M 62M 758M 8% /boot
/dev/sdb15 105M 6.2M 99M 6% /boot/efi
/dev/sda1 74G 4.1G 66G 6% /mnt
tmpfs 1.6G 12K 1.6G 1% /run/user/1001

After clearing disk space:
Filesystem Size Used Avail Use% Mounted on
/dev/root 72G 34G 38G 48% /
tmpfs 7.9G 84K 7.9G 1% /dev/shm
tmpfs 3.2G 1.1M 3.2G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sdb16 881M 62M 758M 8% /boot
/dev/sdb15 105M 6.2M 99M 6% /boot/efi
/dev/sda1 74G 4.1G 66G 6% /mnt
tmpfs 1.6G 12K 1.6G 1% /run/user/1001

Summary:

  • Total disk freed: ~19 GB

Copilot AI review requested due to automatic review settings November 17, 2025 18:19
Copy link
Contributor

Copilot AI left a comment

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 disk space cleanup mechanisms to prevent test-e2e workflow failures caused by insufficient disk space on GitHub Actions runners.

  • Adds a new composite GitHub Action that removes unused packages and Docker images before workflow execution
  • Integrates cache cleanup commands in Python sample Dockerfiles to reduce image size
  • Implements systematic cleanup of common space-consuming directories on GitHub runners

Reviewed Changes

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

Show a summary per file
File Description
.github/actions/initialize-environment/action.yaml New composite action that performs disk cleanup by removing unused packages, tools, and Docker images
.github/workflows/ci.yaml Integrates the new initialize-environment action before the test-e2e job
python/samples/langgraph/currency/Dockerfile Adds apt-get clean and uv cache clean commands to reduce Docker image size
python/samples/crewai/research-crew/Dockerfile Adds apt-get clean and uv cache clean commands to reduce Docker image size
python/samples/crewai/poem_flow/Dockerfile Adds apt-get clean and uv cache clean commands to reduce Docker image size

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

build-essential \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

[nitpick] apt-get clean is redundant after rm -rf /var/lib/apt/lists/*. The rm -rf /var/lib/apt/lists/* command already removes the package lists, and apt-get clean removes downloaded package files from /var/cache/apt/archives/, which is already a minimal operation. Since the standard practice is to use rm -rf /var/lib/apt/lists/* alone in Dockerfiles for size reduction, the additional apt-get clean doesn't provide meaningful benefit and can be removed.

Suggested change
&& apt-get clean

Copilot uses AI. Check for mistakes.
Comment on lines +11 to 13
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

[nitpick] apt-get clean is redundant after rm -rf /var/lib/apt/lists/*. The rm -rf /var/lib/apt/lists/* command already removes the package lists, and apt-get clean removes downloaded package files from /var/cache/apt/archives/, which is already a minimal operation. Since the standard practice is to use rm -rf /var/lib/apt/lists/* alone in Dockerfiles for size reduction, the additional apt-get clean doesn't provide meaningful benefit and can be removed.

Suggested change
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
&& rm -rf /var/lib/apt/lists/*

Copilot uses AI. Check for mistakes.
Comment on lines +11 to 13
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

[nitpick] apt-get clean is redundant after rm -rf /var/lib/apt/lists/*. The rm -rf /var/lib/apt/lists/* command already removes the package lists, and apt-get clean removes downloaded package files from /var/cache/apt/archives/, which is already a minimal operation. Since the standard practice is to use rm -rf /var/lib/apt/lists/* alone in Dockerfiles for size reduction, the additional apt-get clean doesn't provide meaningful benefit and can be removed.

Suggested change
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
&& rm -rf /var/lib/apt/lists/*

Copilot uses AI. Check for mistakes.
Signed-off-by: Fabian Gonzalez <[email protected]>
@peterj peterj merged commit a0f2541 into kagent-dev:main Nov 17, 2025
19 checks passed
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.

2 participants