Skip to content

Commit

Permalink
add more GCP resource deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
amandavialva01 committed Apr 5, 2024
1 parent fc9c543 commit 389fb84
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions .circleci/real_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2694,7 +2694,7 @@ jobs:
mentions: <<parameters.slack-mentions>>
channel: <<parameters.slack-channel>>

run-gke-cluster-cleanup:
run-shared-cluster-cleanup:
parameters:
cluster-id:
type: string
Expand Down Expand Up @@ -2749,6 +2749,31 @@ jobs:
name: Delete GCS CI Buckets
command: |
gsutil ls -p ${GOOGLE_PROJECT_ID} | grep -Eo "^gs://test-[a-z0-9]+-[a-z0-9]+-[0-9]-bucket" | xargs -L1 gsutil rm -r || true
- run:
name: Delete Firewall Rules
command: |
gcloud compute networks get-effective-firewalls $GCP_NETWORK_NAME --project "$GCP_PROJECT_ID" \
--format="table(name)" | tail -n +2 | \
while read fw; do
if [[ $fw =~ "k8s" ]]; then
gcloud compute firewall-rules delete "$fw" --quiet --project "$GCP_PROJECT_ID"
fi
done
- run:
name: Delete Forwarding Rules
command: |
gcloud compute forwarding-rules list --format="table(name)" --project "$GCP_PROJECT_ID" | tail -n +2 | \
while read fr; do
gcloud compute forwarding-rules delete "$fr" --quiet --project "$GCP_PROJECT_ID"
done
- run:
name: Delete Target Pools
command: |
gcloud compute target-pools list --format="table(name)" --project "$GCP_PROJECT_ID" | tail -n +2 | \
while read tp; do
gcloud compute target-pools delete "$tp" --quiet --project "$GCP_PROJECT_ID"
done
workflows:
lint:
Expand Down Expand Up @@ -3632,7 +3657,7 @@ workflows:
deployment-type: efs
slack-mentions: "${SLACK_USER_ID}"

- run-gke-cluster-cleanup:
- run-shared-cluster-cleanup:
name: gke-cleanup
context: gcp-shared-cluster

Expand Down

0 comments on commit 389fb84

Please sign in to comment.