Skip to content

Commit

Permalink
Merge pull request #1585 from rzetelskik/e2e-trap-subprocesses
Browse files Browse the repository at this point in the history
Trap unblocking functions in e2e script's subprocesses
  • Loading branch information
scylla-operator-bot[bot] authored Nov 23, 2023
2 parents 51600cb + 5c24c38 commit 690c9c8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hack/.ci/run-e2e-gke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ function gather-artifacts {

# Setup artifacts transfer when finished and unblock the must-gather pod when done.
(
function unblock-must-gather-pod {
kubectl -n e2e exec pod/must-gather -- bash -euEo pipefail -O inherit_errexit -c "touch /tmp/exit"
}
trap unblock-must-gather-pod EXIT

kubectl -n e2e exec pod/must-gather -- bash -euEo pipefail -O inherit_errexit -c "until [[ -f /tmp/done ]]; do sleep 1; done; ls -l /tmp/artifacts"
kubectl -n e2e cp --retries=42 must-gather:/tmp/artifacts "${ARTIFACTS}/must-gather"
ls -l "${ARTIFACTS}"
kubectl -n e2e exec pod/must-gather -- bash -euEo pipefail -O inherit_errexit -c "touch /tmp/exit"
) &
must_gather_bg_pid=$!

Expand Down Expand Up @@ -156,10 +160,14 @@ kubectl -n e2e wait --for=condition=Ready pod/e2e

# Setup artifacts transfer when finished and unblock the e2e pod when done.
(
function unblock-e2e-pod {
kubectl -n e2e exec pod/e2e -- bash -euEo pipefail -O inherit_errexit -c "touch /tmp/exit"
}
trap unblock-e2e-pod EXIT

kubectl -n e2e exec pod/e2e -- bash -euEo pipefail -O inherit_errexit -c "until [[ -f /tmp/done ]]; do sleep 1; done; ls -l /tmp/artifacts"
kubectl -n e2e cp --retries=42 e2e:/tmp/artifacts "${ARTIFACTS}"
ls -l "${ARTIFACTS}"
kubectl -n e2e exec pod/e2e -- bash -euEo pipefail -O inherit_errexit -c "touch /tmp/exit"
) &
e2e_bg_pid=$!

Expand Down

0 comments on commit 690c9c8

Please sign in to comment.