From 34f9c3f7dee4c4f7b9a8f9bccc8b35131a7ebd4a Mon Sep 17 00:00:00 2001 From: Nicolas Busseneau Date: Wed, 21 Jul 2021 20:47:43 +0200 Subject: [PATCH] workflows: fix in-cluster job kubectl wait Signed-off-by: Nicolas Busseneau --- .github/workflows/gke.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gke.yaml b/.github/workflows/gke.yaml index 04976a1380..f51d3def50 100644 --- a/.github/workflows/gke.yaml +++ b/.github/workflows/gke.yaml @@ -106,7 +106,17 @@ jobs: - name: Wait for job run: | - kubectl -n kube-system wait job/cilium-cli --for=condition=complete --timeout=15m + # Background wait for job to complete or timeout + kubectl -n kube-system wait job/cilium-cli --for=condition=complete --timeout=15m & + complete_pid=$! + + # Background wait for job to fail + (kubectl -n kube-system wait job/cilium-cli --for=condition=failed && exit 1) & + failed_pid=$! + + # Active wait for whichever background wait ends first + wait -n $complete_pid $failed_pid + exit $? - name: Post-test information gathering if: ${{ !success() }}