home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

gcr-nuke.sh (440B)


      1 #!/usr/bin/env bash
      2 set -e
      3 set -o pipefail
      4 
      5 for repository in $(gcloud container images list --format='get(name)');
      6 do
      7     echo ">> Cleaning ${repository}…"
      8     while true; do
      9 	DIGEST=$(gcloud container images list-tags ${repository} --filter='-tags:*' --format='get(digest)' --limit=1)
     10 	if [ -z "${DIGEST}" ]; then
     11 	    break
     12 	fi
     13 	gcloud container images delete ${repository}@${DIGEST} --force-delete-tags --quiet || break
     14     done
     15 done