Skip to content

Commit

Permalink
Update remove_images.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancolgate committed Sep 13, 2024
1 parent e5fb990 commit 0d33cb2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions remove_images.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
DIGESTS=$(doctl registry repository lm $1 --format Digest,UpdatedAt,Tags | tail -n +2 | sort -rk2 | grep -v -E "$3" | awk '{print $1}' | tail -n +$(($2+1)))
DIGESTS=$(doctl registry repository lm $1 --format Digest,UpdatedAt,Tags | tail -n +2 | sort -rk2 | grep -v -E "$4" | awk '{print $1}' | tail -n +$(($2+1)))
for DIGEST in $DIGESTS; do
doctl registry repository delete-manifest $1 $DIGEST --force
done
echo Manifest Digests removed: $DIGESTS

doctl registry garbage-collection start --include-untagged-manifests --force
# Start garbage collection if perform_gc is true
if [ "$3" = true ]; then
doctl registry garbage-collection start --include-untagged-manifests --force
else
echo "Garbage collection is skipped."
fi

0 comments on commit 0d33cb2

Please sign in to comment.