mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-02-04 16:19:09 +08:00
pr feedback
This commit is contained in:
14
dist/index.js
generated
vendored
14
dist/index.js
generated
vendored
@@ -3762,17 +3762,17 @@ class Kubernetes {
|
||||
const imageTag = image.split(':')[1] || 'latest';
|
||||
// More targeted cleanup: remove stopped containers and non-Unity images
|
||||
// IMPORTANT: Preserve Unity images to avoid re-pulling the 3.9GB image
|
||||
// Strategy: Only remove containers, don't prune images (which might remove Unity image)
|
||||
const cleanupCommands = [
|
||||
// Remove all stopped containers (this frees runtime space but keeps images)
|
||||
'docker exec k3d-unity-builder-agent-0 sh -c "crictl rm --all 2>/dev/null || true" || true',
|
||||
'docker exec k3d-unity-builder-server-0 sh -c "crictl rm --all 2>/dev/null || true" || true',
|
||||
// Remove non-Unity images only (preserve unityci/editor images)
|
||||
// List all images, filter out Unity images, then remove the rest
|
||||
'docker exec k3d-unity-builder-agent-0 sh -c "crictl images --format \\"table {{.ID}}\\t{{.Repository}}\\" 2>/dev/null | grep -vE \\"unityci/editor|unity|IMAGE\\" | awk \\"{print \\$1}\\" | xargs -r crictl rmi 2>/dev/null || true" || true',
|
||||
'docker exec k3d-unity-builder-server-0 sh -c "crictl images --format \\"table {{.ID}}\\t{{.Repository}}\\" 2>/dev/null | grep -vE \\"unityci/editor|unity|IMAGE\\" | awk \\"{print \\$1}\\" | xargs -r crictl rmi 2>/dev/null || true" || true',
|
||||
// Clean up unused layers/snapshots (prune should preserve referenced images)
|
||||
'docker exec k3d-unity-builder-agent-0 sh -c "crictl rmi --prune 2>/dev/null || true" || true',
|
||||
'docker exec k3d-unity-builder-server-0 sh -c "crictl rmi --prune 2>/dev/null || true" || true',
|
||||
// Remove specific non-Unity images by name (safer than filtering)
|
||||
// Only remove known system images, preserve everything else including Unity
|
||||
'docker exec k3d-unity-builder-agent-0 sh -c "crictl images --format \\"{{.Repository}}:{{.Tag}}\\" 2>/dev/null | grep -vE \\"unityci/editor|unity\\" | grep -E \\"rancher/|curlimages/|amazon/aws-cli|rclone/rclone|steamcmd/steamcmd|ubuntu:|alpine:\\" | xargs -r -I {} crictl rmi {} 2>/dev/null || true" || true',
|
||||
'docker exec k3d-unity-builder-server-0 sh -c "crictl images --format \\"{{.Repository}}:{{.Tag}}\\" 2>/dev/null | grep -vE \\"unityci/editor|unity\\" | grep -E \\"rancher/|curlimages/|amazon/aws-cli|rclone/rclone|steamcmd/steamcmd|ubuntu:|alpine:\\" | xargs -r -I {} crictl rmi {} 2>/dev/null || true" || true',
|
||||
// DO NOT use --prune as it might remove the Unity image if no containers are using it
|
||||
// Only clean up if we have very little space left
|
||||
];
|
||||
for (const cmd of cleanupCommands) {
|
||||
try {
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user