mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-02-02 06:39:05 +08:00
fixes
This commit is contained in:
62
.github/workflows/cloud-runner-integrity.yml
vendored
62
.github/workflows/cloud-runner-integrity.yml
vendored
@@ -30,6 +30,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
K3D_NODE_CONTAINERS: 'k3d-unity-builder-agent-0'
|
||||
AWS_FORCE_PROVIDER: aws
|
||||
RESOURCE_TRACKING: 'true'
|
||||
steps:
|
||||
# ==========================================
|
||||
# SETUP SECTION
|
||||
@@ -223,66 +225,6 @@ jobs:
|
||||
kubectl run test-localstack --image=curlimages/curl --rm -i --restart=Never --timeout=10s -- \
|
||||
curl -v --max-time 5 http://host.k3d.internal:4566/_localstack/health 2>&1 | head -20 || \
|
||||
echo "Cluster connectivity test - if this fails, LocalStack may not be accessible from k3d"
|
||||
- name: Pre-pull Unity image into k3d cluster
|
||||
timeout-minutes: 15
|
||||
run: |
|
||||
# Pre-pull the Unity image into the k3d cluster before running tests
|
||||
# This ensures it's cached in the k3d node's containerd and won't need to be pulled during test execution
|
||||
UNITY_IMAGE="unityci/editor:ubuntu-2021.3.45f1-base-3"
|
||||
|
||||
# Check disk space before pulling
|
||||
echo "Checking disk space before pre-pulling Unity image..."
|
||||
K3D_NODE_CONTAINERS="${K3D_NODE_CONTAINERS:-k3d-unity-builder-agent-0 k3d-unity-builder-server-0}"
|
||||
for NODE in $K3D_NODE_CONTAINERS; do
|
||||
echo "Disk space in $NODE:"
|
||||
docker exec "$NODE" sh -c "df -h /var/lib/rancher/k3s 2>/dev/null || df -h / 2>/dev/null || true" || true
|
||||
done
|
||||
|
||||
# Clean up before pulling to ensure we have space
|
||||
echo "Cleaning up before pre-pulling image..."
|
||||
for NODE in $K3D_NODE_CONTAINERS; do
|
||||
docker exec "$NODE" sh -c "crictl rm --all 2>/dev/null || true" || true
|
||||
# Only remove non-Unity images to preserve space while keeping Unity image if already cached
|
||||
docker exec "$NODE" sh -c "for img in \$(crictl images -q 2>/dev/null); do repo=\$(crictl inspecti \$img --format '{{.repo}}' 2>/dev/null || echo ''); if echo \"\$repo\" | grep -qvE 'unityci/editor|unity'; then crictl rmi \$img 2>/dev/null || true; fi; done" || true
|
||||
done || true
|
||||
|
||||
# Explicitly pull the image on BOTH nodes to ensure it's cached wherever pods might be scheduled
|
||||
# This prevents "no space left" errors when pods are scheduled on nodes without the cached image
|
||||
echo "Pulling Unity image directly on each node to ensure it's cached..."
|
||||
for NODE in $K3D_NODE_CONTAINERS; do
|
||||
echo "Checking if image already exists on $NODE..."
|
||||
IMAGE_EXISTS=$(docker exec "$NODE" sh -c "crictl images | grep -q unityci/editor && echo 'yes' || echo 'no'" || echo "no")
|
||||
if [ "$IMAGE_EXISTS" = "yes" ]; then
|
||||
echo "Unity image already cached on $NODE, skipping pull"
|
||||
else
|
||||
echo "Pulling Unity image on $NODE (this may take several minutes for 3.9GB image)..."
|
||||
# Use crictl pull directly in the node's containerd
|
||||
# This ensures the image is cached in the node's local storage
|
||||
# Use timeout to prevent hanging indefinitely (10 minutes max)
|
||||
if timeout 600 docker exec "$NODE" sh -c "crictl pull $UNITY_IMAGE 2>&1"; then
|
||||
echo "Successfully pulled image on $NODE"
|
||||
# Verify it's cached
|
||||
docker exec "$NODE" sh -c "crictl images | grep unityci/editor || echo 'Warning: Image not found after pull'" || true
|
||||
else
|
||||
PULL_EXIT_CODE=$?
|
||||
if [ $PULL_EXIT_CODE -eq 124 ]; then
|
||||
echo "Warning: Image pull on $NODE timed out after 10 minutes. Checking if partially cached..."
|
||||
else
|
||||
echo "Warning: Image pull on $NODE failed (exit code: $PULL_EXIT_CODE). Checking if partially cached..."
|
||||
fi
|
||||
docker exec "$NODE" sh -c "crictl images | grep unityci/editor || echo 'Image not found on $NODE'" || true
|
||||
echo "Note: Pods scheduled on $NODE will attempt to pull the image during runtime, which may fail if disk space is insufficient."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Verify image is cached
|
||||
echo "Checking if Unity image is cached..."
|
||||
for NODE in $K3D_NODE_CONTAINERS; do
|
||||
docker exec "$NODE" sh -c "crictl images | grep unityci/editor || echo 'Image not found in $NODE'" || true
|
||||
done
|
||||
|
||||
echo "Image pre-pull completed. Image should be cached in k3d node."
|
||||
- name: Clean up K8s test resources before tests
|
||||
run: |
|
||||
echo "Cleaning up K8s test resources..."
|
||||
|
||||
Reference in New Issue
Block a user