Skip to content

Commit

Permalink
unused aws instace and vpcs cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: shiva kumar <[email protected]>
  • Loading branch information
shivakunv committed Dec 18, 2024
1 parent 0695c4d commit 633c719
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/awscleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,15 @@ jobs:
job_name=$(get_tag_value $vpc "GithubJob")
response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/repos/NVIDIA/${github_repository}/actions/runs/${run_id}/jobs")
status=$(echo "$response" | jq -r ".jobs[] | select(.name | test(\"^$job_name\")) | .status")
echo "SHIVA response $response"
if [[ -z "$response" || "$response" == "null" ]]; then
continue
fi
status=$(echo "$response" | jq -r ".jobs[] | select(.name | test(\"^$job_name\")) | .status" 2>/dev/null || echo "null")
echo "SHIVA status $status"
echo "$status" | grep -qvE '^(queued|in_progress)$'
echo "KUMAR"
if echo "$status" | grep -qvE '^(queued|in_progress)$'; then
if [[ "$status" != "null" && ! -z "$status" && $(echo "$status" | grep -qvE '^(queued|in_progress)$'; echo $?) -eq 0 ]]; then
echo "Holodeck Job status is not in running stage , Delete the dependend resources"
scripts/awscleanup.sh $vpc
fi
Expand Down
1 change: 1 addition & 0 deletions scripts/awscleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ aws resourcegroupstaggingapi get-resources --tag-filters Key=vpc-id,Values=$vpci

aws_resources=$(aws resourcegroupstaggingapi get-resources --tag-filters Key=vpc-id,Values=$vpcid)

echo $aws_resources
exit 1
# Delete Instance
for instance in $instances; do
Expand Down

0 comments on commit 633c719

Please sign in to comment.