Add AppEngine cleanup to appropriate CloudBuild scripts.
Behind the scenes we do the following on a VM:
Have a crontab that has (truncated):
# m h dom mon dow command
0 1 * * * /home/markmandel/build/cleanup/cleanup-appengine.sh preview 30
0 2 * * * /home/markmandel/build/cleanup/cleanup-appengine.sh default 10
0 3 * * * /home/markmandel/build/cleanup/cleanup-appengine.sh development 10
and cleanup-appengine.sh has the following content:
#!/bin/bash
set -o xtrace
gcloud app versions list --service=$1 --filter="traffic_split<1" --sort-by=~last_deployed_time.datetime --format="table[no-heading](version.id)" | tail -n +$2 | xargs gcloud app versions delete --service=$1
Rather than doing this in a random VM, let's do this in our cloudbuild scripts for each of the AppEngine services outlined above.
Implementation thought: I'd suggest just outputting what would be deleted (dry run essentially) for a short period rather than delete. so we can review if it's working correctly before setting it to actually delete items.
- https://github.com/googleforgames/agones/blob/main/cloudbuild.yaml -
previewservice cleanup should go here. - https://github.com/googleforgames/agones/blob/main/site/cloudbuild.yaml -
developmentanddefaultservice cleanup should go here.
Hi @kamaljeeti, Please work on this issue and let me know if you need any help.
Offline chat: let's put everything in https://github.com/googleforgames/agones/blob/main/cloudbuild.yaml