agones icon indicating copy to clipboard operation
agones copied to clipboard

Add AppEngine cleanup to appropriate CloudBuild scripts.

Open markmandel opened this issue 1 year ago • 2 comments

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 - preview service cleanup should go here.
  • https://github.com/googleforgames/agones/blob/main/site/cloudbuild.yaml - development and default service cleanup should go here.

markmandel avatar Jun 05 '24 21:06 markmandel

Hi @kamaljeeti, Please work on this issue and let me know if you need any help.

ashutosji avatar Jun 20 '24 07:06 ashutosji

Offline chat: let's put everything in https://github.com/googleforgames/agones/blob/main/cloudbuild.yaml

markmandel avatar Jun 26 '24 16:06 markmandel