Skip to content

Commit 8db7e66

Browse files
committed
ci: use parallel KWOK testing for faster recipe validation
1 parent f9b2402 commit 8db7e66

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

.github/actions/kwok-test/action.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
name: 'KWOK Cluster Test'
16-
description: 'Test recipes using KWOK simulated nodes in a shared Kind cluster'
16+
description: 'Test recipes using KWOK simulated nodes in parallel Kind clusters'
1717

1818
inputs:
1919
recipe:
@@ -160,39 +160,39 @@ runs:
160160
id: validate
161161
shell: bash
162162
env:
163-
KWOK_CLUSTER: aicr-kwok-test
163+
KWOK_CLUSTER_PREFIX: aicr-kwok-test
164164
KIND_NODE_IMAGE: ${{ inputs.kind_node_image }}
165165
run: |
166-
bash kwok/scripts/run-all-recipes.sh ${{ inputs.recipe }}
166+
if [[ -n "${{ inputs.recipe }}" ]]; then
167+
# Single recipe: use sequential script with dedicated cluster
168+
KWOK_CLUSTER=aicr-kwok-test bash kwok/scripts/run-all-recipes.sh ${{ inputs.recipe }}
169+
else
170+
# All recipes: use parallel script for faster execution
171+
bash kwok/scripts/run-all-recipes-parallel.sh
172+
fi
167173
168174
- name: Collect debug artifacts
169175
if: failure()
170176
shell: bash
171-
env:
172-
KWOK_CLUSTER: aicr-kwok-test
173177
run: |
174178
mkdir -p /tmp/kwok-debug-artifacts
175-
kubectl get all --all-namespaces > /tmp/kwok-debug-artifacts/all-resources.txt || true
176-
kubectl get nodes -o wide > /tmp/kwok-debug-artifacts/nodes.txt || true
177-
kubectl get nodes -l type=kwok -o yaml > /tmp/kwok-debug-artifacts/kwok-nodes.yaml || true
178-
kubectl get events --all-namespaces --sort-by='.lastTimestamp' > /tmp/kwok-debug-artifacts/events.txt || true
179-
kubectl get pods --all-namespaces -o wide > /tmp/kwok-debug-artifacts/pods.txt || true
180-
181-
# Get pending pod details
182-
for ns in $(kubectl get ns -o jsonpath='{.items[*].metadata.name}'); do
183-
for pod in $(kubectl get pods -n "$ns" --field-selector=status.phase=Pending -o jsonpath='{.items[*].metadata.name}' 2>/dev/null); do
184-
kubectl describe pod -n "$ns" "$pod" > "/tmp/kwok-debug-artifacts/pending-${ns}-${pod}.txt" 2>/dev/null || true
185-
done
179+
# Collect from whichever cluster is still running
180+
for cluster in $(kind get clusters 2>/dev/null); do
181+
kind export kubeconfig --name "$cluster" 2>/dev/null || continue
182+
kubectl get all --all-namespaces > "/tmp/kwok-debug-artifacts/${cluster}-resources.txt" || true
183+
kubectl get nodes -o wide > "/tmp/kwok-debug-artifacts/${cluster}-nodes.txt" || true
184+
kubectl get events --all-namespaces --sort-by='.lastTimestamp' > "/tmp/kwok-debug-artifacts/${cluster}-events.txt" || true
185+
kubectl get pods --all-namespaces -o wide > "/tmp/kwok-debug-artifacts/${cluster}-pods.txt" || true
186186
done
187187
188188
- name: Export Kind logs
189189
if: failure()
190190
shell: bash
191-
env:
192-
KWOK_CLUSTER: aicr-kwok-test
193191
run: |
194192
mkdir -p /tmp/kwok-kind-logs
195-
kind export logs /tmp/kwok-kind-logs --name "${KWOK_CLUSTER}" || true
193+
for cluster in $(kind get clusters 2>/dev/null); do
194+
kind export logs "/tmp/kwok-kind-logs/${cluster}" --name "$cluster" || true
195+
done
196196
197197
- name: Upload debug artifacts
198198
if: failure() && inputs.upload_artifacts == 'true'
@@ -207,8 +207,8 @@ runs:
207207
- name: Cleanup
208208
if: always()
209209
shell: bash
210-
env:
211-
KWOK_CLUSTER: aicr-kwok-test
212210
run: |
213-
kind delete cluster --name "${KWOK_CLUSTER}" || true
211+
for cluster in $(kind get clusters 2>/dev/null); do
212+
kind delete cluster --name "$cluster" || true
213+
done
214214
docker system prune -f || true

0 commit comments

Comments
 (0)