GoogleCloudPlatform/emblem

`cleanup.sh` double-deletes if PROD_PROJECT == STAGE_PROJECT

ace-n opened this issue · 0 comments

ace-n commented

Currently, cleanup.sh` fails if resources are missing.

For example, the following error was caused by a missing (i.e. already deleted) website Cloud Run service:

Deleting [website]...failed.                                                                                                           
ERROR: (gcloud.run.services.delete) Service [website] could not be found.
Exited [1] at line 59 cleanup.sh:
    56	gcloud run services delete --project $STAGE_PROJECT --region $REGION website --quiet
    57	gcloud run services delete --project $STAGE_PROJECT --region $REGION content-api --quiet
    58	
>>>     59	gcloud run services delete --project $PROD_PROJECT --region $REGION website --quiet
    60	gcloud run services delete --project $PROD_PROJECT --region $REGION content-api --quiet
    61	
    62	# Delete Firestore data

We should fix that. 🙂


UPDATE: This occurs when PROD_PROJECT and STAGE_PROJECT are equal. We need to wrap the second gcloud run services delete in an if-statement.