From 7b71fe70cc3db09f2e6867ecb165acd5650aaaf7 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Sat, 14 Dec 2019 13:13:28 +0100 Subject: [PATCH] Handle non TTY in registry-cleaner script --- registry-cleaner.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/registry-cleaner.sh b/registry-cleaner.sh index 06d2bfc..210f8ed 100755 --- a/registry-cleaner.sh +++ b/registry-cleaner.sh @@ -12,7 +12,9 @@ DIRNAME=$(dirname $SCRIPT) # Soft delete untagged images. # ----------------------------------------------------------------------------- -echo -e "${CYAN}[${SCRIPT}] Soft delete untagged images ${NC}" +if [ -t 1 ]; then + echo -e "${CYAN}[${SCRIPT}] Soft delete untagged images ${NC}" +fi install="pip3 install gitlab-registry-cleanup" cleanup="gitlab-registry-cleanup -g https://gitlab.wojciechkozlowski.eu -r https://registry.wojciechkozlowski.eu -c /gitlab.cred" @@ -25,6 +27,8 @@ docker run -it --rm --volumes-from gitlab \ # Garbage collect and hard delete untagged images. # ----------------------------------------------------------------------------- -echo -e "${CYAN}[${SCRIPT}] Garbage collect untagged images ${NC}" +if [ -t 1 ]; then + echo -e "${CYAN}[${SCRIPT}] Garbage collect untagged images ${NC}" +fi docker exec gitlab bash -c "gitlab-ctl registry-garbage-collect"