Update registry cleaner

This commit is contained in:
Wojciech Kozlowski 2019-12-14 13:02:50 +01:00
parent 43484bbb4b
commit 8f02e4c9aa
3 changed files with 11 additions and 4 deletions

2
ansible/gitlab.cred.j2 Normal file
View File

@ -0,0 +1,2 @@
{{ gitlab_username }}
{{ gitlab_access_token }}

View File

@ -33,3 +33,8 @@ fail2ban_sender:
# For /etc/hosts
domains:
# Loki setup
loki_dir:
gitlab_username:
gitlab_access_token:

View File

@ -3,8 +3,6 @@
set -e
CYAN='\033[01;36m'
YELLOW='\033[01;33m'
RED='\033[01;31m'
NC='\033[00m'
SCRIPT=$(readlink -f $0)
@ -17,9 +15,11 @@ DIRNAME=$(dirname $SCRIPT)
echo -e "${CYAN}[${SCRIPT}] Soft delete untagged images ${NC}"
install="pip3 install gitlab-registry-cleanup"
cleanup="gitlab-registry-cleanup -g https://gitlab.wojciechkozlowski.eu -r https://registry.wojciechkozlowski.eu -u wojtek"
cleanup="gitlab-registry-cleanup -g https://gitlab.wojciechkozlowski.eu -r https://registry.wojciechkozlowski.eu -c /gitlab.cred"
docker run -it --rm --volumes-from gitlab python bash -c "${install} && ${cleanup}"
docker run -it --rm --volumes-from gitlab \
-v ${DIRNAME}/gitlab.cred:/gitlab.cred \
python bash -c "${install} && ${cleanup}"
# -----------------------------------------------------------------------------
# Garbage collect and hard delete untagged images.