home

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

commit 582db084b182d756972c9db9b240ebbc5760e412
parent 106fc534e40e98ecd6d1b26e50a8c5c030c3d8b2
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Thu,  2 Nov 2023 11:50:33 +0100

nix/packages: add a script to nuke gcr

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Anix/packages/my/scripts/bin/gcr-nuke.sh | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/nix/packages/my/scripts/bin/gcr-nuke.sh b/nix/packages/my/scripts/bin/gcr-nuke.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -e +set -o pipefail + +for repository in $(gcloud container images list --format='get(name)'); +do + echo ">> Cleaning ${repository}…" + while true; do + DIGEST=$(gcloud container images list-tags ${repository} --format='get(digest)' --limit=1) + if [ -z "${DIGEST}" ]; then + break + fi + gcloud container images delete ${repository}@${DIGEST} --force-delete-tags --quiet + done +done