From 67619876ce854c990a72b7a45e36dddd935f6ce6 Mon Sep 17 00:00:00 2001 From: jbtrystram Date: Tue, 2 Jul 2024 11:37:42 +0200 Subject: [PATCH] cmd/prune-contaiers: add a GC script for containers images This script calls skopeo delete to prune image from a remote directory. Currently only supports the FCOS tag structure. If no duration is specified, no image will be pruned. See https://github.com/coreos/fedora-coreos-tracker/issues/1367 See https://github.com/coreos/fedora-coreos-pipeline/pull/995 --- src/prune-containers | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 src/prune-containers diff --git a/src/prune-containers b/src/prune-containers new file mode 100755 index 0000000000..f1dfe7bdcc --- /dev/null +++ b/src/prune-containers @@ -0,0 +1,12 @@ +#!/usr/bin/bash + +# 1 - list all tags from repo +REGISTRY="quay.io/fedora-ostree-desktops/silverblue" + +TAGS_JSON=skopeo list-tags docker://${REGISTRY} | jq -r '.Tags[]' + +# 2 go through list and print date and stream +for tag in $TAGS_JSON; +do + echo $tag +done