From 8f02e4c9aa6700ef35731990fe6d5c5da7f9c360 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Sat, 14 Dec 2019 13:02:50 +0100 Subject: [PATCH] Update registry cleaner --- ansible/gitlab.cred.j2 | 2 ++ ansible/secrets.def.yml | 5 +++++ registry-cleaner.sh | 8 ++++---- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 ansible/gitlab.cred.j2 diff --git a/ansible/gitlab.cred.j2 b/ansible/gitlab.cred.j2 new file mode 100644 index 0000000..de895a1 --- /dev/null +++ b/ansible/gitlab.cred.j2 @@ -0,0 +1,2 @@ +{{ gitlab_username }} +{{ gitlab_access_token }} \ No newline at end of file diff --git a/ansible/secrets.def.yml b/ansible/secrets.def.yml index 490cd1c..bc8bde9 100644 --- a/ansible/secrets.def.yml +++ b/ansible/secrets.def.yml @@ -33,3 +33,8 @@ fail2ban_sender: # For /etc/hosts domains: + +# Loki setup +loki_dir: +gitlab_username: +gitlab_access_token: diff --git a/registry-cleaner.sh b/registry-cleaner.sh index dc40dd2..06d2bfc 100755 --- a/registry-cleaner.sh +++ b/registry-cleaner.sh @@ -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.