Skip to content

Commit

Permalink
.github: Parallelize cleanup of multicluster setup
Browse files Browse the repository at this point in the history
When a GitHub job is cancelled, we have 5 minutes to perform any cleanup
action [1]. After that time, the job is forcefully stopped. That means
for jobs creating Kubernetes clusters, we have 5 minutes to delete the
cluster(s) or they will be left behind.

In the GKE test, it takes us around 2 minutes to delete the cluster. In
the multicluster test however, deleting the two GKE clusters takes us a
bit more than 5 minutes on average.

This commit parallelize the deletion of the two clusters in the
multicluster test to get the cleanup step below the 5-minutes runtime
threshold.

1 - https://docs.github.com/en/actions/managing-workflow-runs/canceling-a-workflow#steps-github-takes-to-cancel-a-workflow-run
Reported-by: Maciej Kwiek <maciej@isovalent.com>
Signed-off-by: Paul Chaignon <paul@cilium.io>
  • Loading branch information
pchaigno authored and twpayne committed May 21, 2021
1 parent 451de22 commit ba737f3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/multicluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,16 @@ jobs:
- name: Clean up GKE
if: ${{ always() }}
run: |
gcloud container clusters delete ${{ env.clusterName1 }} --zone ${{ env.zone }} --quiet
gcloud container clusters delete ${{ env.clusterName2 }} --zone ${{ env.zone }} --quiet
i=0
for e in ${{ env.clusterName1 }} ${{ env.clusterName2 }}; do
gcloud container clusters delete $e --zone ${{ env.zone }} --quiet &
pids[$i]=$!
((i++))
done
# Wait for all cluster-cleanup processes.
for pid in ${pids[*]}; do
wait $pid
done
shell: bash {0}

- name: Upload artifacts
Expand Down

0 comments on commit ba737f3

Please sign in to comment.