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 88a1ff0 commit 2f0e023
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/awscleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,23 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
get_tag_value(){
local vpc_id=$1
local key=$2
aws ec2 describe-tags --filters "Name=resource-id,Values=$vpc_id" "Name=key,Values=$key" \
--query "Tags[0].Value" --output text
}
for vpc in $vpcs; do
GITHUB_REPOSITORY1=gpu-driver-container
RUN_ID1="12338981626"
JOB_NAME=e2e-tests-nvidiadriver
github_repository=$(get_tag_value $vpc "RepoName")
run_id=$(get_tag_value $vpc "GithubRunId")
run_id=$(get_tag_value $vpc "GithubRunId")
# SHIVA GithubJob
job_name=$(get_tag_value $vpc "githubJob")
response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/repos/NVIDIA/${GITHUB_REPOSITORY1}/actions/runs/${RUN_ID1}/jobs")
"https://api.github.com/repos/NVIDIA/${github_repository}/actions/runs/${run_id}/jobs")
echo "SHIVA $response"
status=$(echo "$response" | jq -r ".jobs[] | select(.name | test(\"^$JOB_NAME\")) | .status")
status=$(echo "$response" | jq -r ".jobs[] | select(.name | test(\"^$job_name\")) | .status")
echo "status=$status"
if [[ $status != 'queued' && $status != 'in_progress' ]]; then
Expand Down

0 comments on commit 2f0e023

Please sign in to comment.