forked from henrik242/docr-image-remove
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5fb990
commit 0d33cb2
Showing
1 changed file
with
7 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |