From 69731babfc9388dd1f8c59822ea150e6e6e1bd93 Mon Sep 17 00:00:00 2001 From: Frostebite Date: Fri, 5 Dec 2025 17:20:01 +0000 Subject: [PATCH] PR feedback --- .github/workflows/cloud-runner-integrity.yml | 180 +++++++++++++------ 1 file changed, 123 insertions(+), 57 deletions(-) diff --git a/.github/workflows/cloud-runner-integrity.yml b/.github/workflows/cloud-runner-integrity.yml index 23d3e792..29f1332b 100644 --- a/.github/workflows/cloud-runner-integrity.yml +++ b/.github/workflows/cloud-runner-integrity.yml @@ -28,61 +28,41 @@ jobs: k8s: name: Cloud Runner Tests (K8s) runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - # K8s runs (k3s) - - test: 'cloud-runner-end2end-caching' - provider: k8s - - test: 'cloud-runner-end2end-retaining' - provider: k8s - - test: 'cloud-runner-hooks' - provider: k8s steps: - uses: actions/checkout@v4 with: lfs: false - # Set up Kubernetes (k3s via k3d) only for k8s matrix entries + # Set up Kubernetes (k3s via k3d) - name: Set up kubectl - if: ${{ matrix.provider == 'k8s' }} uses: azure/setup-kubectl@v4 with: version: 'v1.34.1' - name: Install k3d - if: ${{ matrix.provider == 'k8s' }} run: | curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash k3d version | cat - name: Create k3s cluster (k3d) - if: ${{ matrix.provider == 'k8s' }} + timeout-minutes: 5 run: | - # Create cluster with relaxed eviction thresholds to prevent premature evictions - k3d cluster create unity-builder \ - --agents 1 \ - --k3s-arg '--kubelet-arg=eviction-hard=memory.available<50Mi@agent:0' \ - --k3s-arg '--kubelet-arg=eviction-soft=memory.available<100Mi@agent:0' \ - --wait + # Create cluster with basic configuration + # Using simpler setup to avoid hangs - resource limits handled via container requests + k3d cluster create unity-builder --agents 1 --wait kubectl config current-context | cat - name: Verify cluster readiness - if: ${{ matrix.provider == 'k8s' }} + timeout-minutes: 2 run: | - for i in {1..60}; do kubectl get nodes && break || sleep 5; done + for i in {1..60}; do + if kubectl get nodes 2>/dev/null | grep -q Ready; then + echo "Cluster is ready" + break + fi + echo "Waiting for cluster... ($i/60)" + sleep 5 + done + kubectl get nodes kubectl get storageclass # Show node resources kubectl describe nodes | grep -A 5 "Allocated resources" || true - - name: Clean up old K8s resources before tests - if: ${{ matrix.provider == 'k8s' }} - run: | - # Clean up any leftover jobs, pods, and PVCs from previous test runs - kubectl delete jobs --all --ignore-not-found=true || true - kubectl delete pods --all --ignore-not-found=true || true - kubectl delete pvc --all --ignore-not-found=true || true - kubectl delete secrets --all --ignore-not-found=true || true - # Wait a moment for cleanup to complete - sleep 5 - # Show current resource usage - kubectl top nodes 2>/dev/null || echo "Metrics server not available" - name: Start LocalStack (S3) uses: localstack/setup-localstack@v0.2.4 with: @@ -105,8 +85,58 @@ jobs: # Show available disk space df -h - run: yarn install --frozen-lockfile - - run: yarn run test "${{ matrix.test }}" --detectOpenHandles --forceExit --runInBand - timeout-minutes: 60 + - name: Run K8s tests sequentially + timeout-minutes: 180 + run: | + # List of K8s tests to run sequentially + tests=( + "cloud-runner-end2end-caching" + "cloud-runner-end2end-retaining" + "cloud-runner-hooks" + ) + + failed_tests=() + + for test in "${tests[@]}"; do + echo "=========================================" + echo "Running test: $test" + echo "=========================================" + + # Clean up K8s resources before each test + echo "Cleaning up K8s resources before test..." + kubectl delete jobs --all --ignore-not-found=true --all-namespaces || true + kubectl delete pods --all --ignore-not-found=true --all-namespaces || true + kubectl delete pvc --all --ignore-not-found=true --all-namespaces || true + kubectl delete secrets --all --ignore-not-found=true --all-namespaces || true + sleep 3 + + # Clean up disk space before each test + rm -rf ./cloud-runner-cache/* || true + docker system prune -f || true + + # Run the test + if yarn run test "$test" --detectOpenHandles --forceExit --runInBand; then + echo "✓ Test $test passed" + else + echo "✗ Test $test failed" + failed_tests+=("$test") + fi + + echo "" + done + + # Report results + if [ ${#failed_tests[@]} -eq 0 ]; then + echo "=========================================" + echo "All tests passed!" + echo "=========================================" + exit 0 + else + echo "=========================================" + echo "Failed tests: ${failed_tests[*]}" + echo "=========================================" + exit 1 + fi env: UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} @@ -115,11 +145,11 @@ jobs: TARGET_PLATFORM: StandaloneWindows64 cloudRunnerTests: true versioning: None - KUBE_STORAGE_CLASS: ${{ matrix.provider == 'k8s' && 'local-path' || '' }} - PROVIDER_STRATEGY: ${{ matrix.provider }} + KUBE_STORAGE_CLASS: local-path + PROVIDER_STRATEGY: k8s # Set lower resource requests for tests to prevent evictions in k3d - containerCpu: ${{ matrix.provider == 'k8s' && '512' || '' }} - containerMemory: ${{ matrix.provider == 'k8s' && '512' || '' }} + containerCpu: '512' + containerMemory: '512' AWS_ACCESS_KEY_ID: test AWS_SECRET_ACCESS_KEY: test AWS_S3_ENDPOINT: http://localhost:4566 @@ -140,20 +170,6 @@ jobs: - 4566:4566 env: SERVICES: cloudformation,ecs,kinesis,cloudwatch,s3,logs - strategy: - fail-fast: false - matrix: - test: - - 'cloud-runner-end2end-locking' - - 'cloud-runner-end2end-caching' - - 'cloud-runner-end2end-retaining' - - 'cloud-runner-caching' - - 'cloud-runner-environment' - - 'cloud-runner-image' - - 'cloud-runner-hooks' - - 'cloud-runner-local-persistence' - - 'cloud-runner-locking-core' - - 'cloud-runner-locking-get-locked' steps: - uses: actions/checkout@v4 with: @@ -172,8 +188,58 @@ jobs: # Show available disk space df -h - run: yarn install --frozen-lockfile - - run: yarn run test "${{ matrix.test }}" --detectOpenHandles --forceExit --runInBand - timeout-minutes: 60 + - name: Run LocalStack tests sequentially + timeout-minutes: 300 + run: | + # List of LocalStack tests to run sequentially + tests=( + "cloud-runner-end2end-locking" + "cloud-runner-end2end-caching" + "cloud-runner-end2end-retaining" + "cloud-runner-caching" + "cloud-runner-environment" + "cloud-runner-image" + "cloud-runner-hooks" + "cloud-runner-local-persistence" + "cloud-runner-locking-core" + "cloud-runner-locking-get-locked" + ) + + failed_tests=() + + for test in "${tests[@]}"; do + echo "=========================================" + echo "Running test: $test" + echo "=========================================" + + # Clean up disk space before each test + rm -rf ./cloud-runner-cache/* || true + docker system prune -f || true + df -h + + # Run the test + if yarn run test "$test" --detectOpenHandles --forceExit --runInBand; then + echo "✓ Test $test passed" + else + echo "✗ Test $test failed" + failed_tests+=("$test") + fi + + echo "" + done + + # Report results + if [ ${#failed_tests[@]} -eq 0 ]; then + echo "=========================================" + echo "All tests passed!" + echo "=========================================" + exit 0 + else + echo "=========================================" + echo "Failed tests: ${failed_tests[*]}" + echo "=========================================" + exit 1 + fi env: UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}