Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [Terraform] Create github action to delete projects in the test env #1378

Merged
merged 6 commits into from
Aug 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update cleanup-test-env.sh
andreaangiolillo committed Aug 9, 2023

Verified

This commit was signed with the committer’s verified signature.
sandhose Quentin Gliech
commit 3776b53c277ca17c586867ef3dc75b9596d45e4e
6 changes: 3 additions & 3 deletions scripts/cleanup-test-env.sh
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ projectToSkip="${PROJECT_TO_NOT_DELETE:-NONE}"
# Get all project Ids inside the organization
projects=$(atlas project ls -o json)

echo ${projects} | jq -c '.results[].id' | while read id; do
echo "${projects}" | jq -c '.results[].id' | while read id; do
# Trim the quotes from the id
clean_project_id=$(echo "$id" | tr -d '"')

@@ -30,13 +30,13 @@ echo ${projects} | jq -c '.results[].id' | while read id; do
continue
fi

clusters=$(atlas cluster ls --projectId ${clean_project_id} -o=go-template="{{.TotalCount}}")
clusters=$(atlas cluster ls --projectId "${clean_project_id}" -o=go-template="{{.TotalCount}}")
if [ "${clusters}" != "0" ]; then
echo "Project ${clean_project_id} contains clusters. Skipping..."
continue
fi

echo "Deleting projectId ${clean_string_id}"
# This command will fail if the project has a cluster inside
atlas project delete ${clean_project_id} --force
atlas project delete "${clean_project_id}" --force
done