From 385fcb78b19faecca803fdab52dd6f25f4ec4911 Mon Sep 17 00:00:00 2001 From: shiva kumar Date: Thu, 19 Dec 2024 18:50:52 +0530 Subject: [PATCH] unused aws instace and vpcs cleanup Signed-off-by: shiva kumar --- .github/workflows/awscleanup.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/awscleanup.yaml b/.github/workflows/awscleanup.yaml index a4e8024f..2b0c5dc6 100644 --- a/.github/workflows/awscleanup.yaml +++ b/.github/workflows/awscleanup.yaml @@ -57,10 +57,13 @@ jobs: if [[ -z "$response" || "$response" == "null" ]]; then continue fi - echo $response - exit 0 - status=$(echo "$response" | jq -r ".jobs? // [] | map(select(.name | test(\"^$job_name\"))) | .[0]?.status // \"null\"" 2>/dev/null || echo "null") - if [[ "$status" != "null" && ! -z "$status" && $(echo "$status" | grep -qvE '^(queued|in_progress)$'; echo $?) -eq 0 ]]; then + echo "SHIVA $response" + is_job_running=$(echo "$response" | jq -r " + .jobs? // [] | + map(select(.status == \"in_progress\" or .status == \"queued\")) | + length + ") + if [[ "$is_job_running" -eq 0 ]]; then echo "Holodeck e2e Job status is not in running stage , Delete the dependent resources" scripts/awscleanup.sh $vpc fi