From 90a74e0792ae1418b01db7878abcf2cc8416b909 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Mon, 1 Mar 2021 12:26:31 +0100 Subject: [PATCH] chg: doc: [rocketchat] update doc to use =docker-tags-fetch= Signed-off-by: Valentin Lab --- rocketchat/README.org | 49 +++---------------------------------------- 1 file changed, 3 insertions(+), 46 deletions(-) diff --git a/rocketchat/README.org b/rocketchat/README.org index 3f548ef..92db1ca 100644 --- a/rocketchat/README.org +++ b/rocketchat/README.org @@ -30,52 +30,9 @@ from: https://hub.docker.com/r/rocketchat/rocket.chat Get the available tags: #+begin_src sh -IMAGE_BASE_NAME=rocket.chat - -## lookup on docker hub only. Could think doing it for any docker -## image identifier available on `pull`. This would mean querying -## other registries, probably with a different api. -docker:lookup_available_tags() { - local image="$1" limit="${2:-10}" filter="$3" eor p - - ## remove any tags on image name - image="${image%%:*}" - - if [[ "$image" == *"/"* ]]; then - username="${image%%/*}" - image="${image##*/}" - else - username="library" - fi - - p=0 - eor= - while [ -z "$eor" ]; do - ((p++)) - out=$(curl -s "https://registry.hub.docker.com/v2/repositories/$username/$image/tags/?page=$p" | - jq -r '."results"[]["name"]') || break - [ -z "$out" ] && break - ## 10 results are expected per request, otherwise - ## this means we are hitting End of Records. - nb_result=$(printf "%s\n" "$out" | wc -l) - [ "$nb_result" -lt 10 ] && eor=true - ## filter records - [ "$filter" ] && out=$(printf "%s\n" "$out" | egrep "$filter") - [ -z "$out" ] && continue - nb_result=$(printf "%s\n" "$out" | wc -l) - if [ "$limit" -le "$nb_result" ]; then - printf "%s\n" "$out" | head -n "$limit" - break - fi - printf "%s\n" "$out" - limit=$((limit - nb_result)) - done - -} - -docker:lookup_available_tags rocketchat/rocket.chat 15 "^[0-9]+(\.[0-9]+)*$" - +docker-tags-fetch rocket.chat -l 15 -f "^[0-9]+\.[0-9]+\.[0-9]+" | sort -V #+end_src Rocket.chat has a powerfull and working update database that will -take care of migrating database on startup. \ No newline at end of file +take care of migrating database on startup. +