Browse Source

chg: doc: [rocketchat] update doc to use =docker-tags-fetch=

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
dev
Valentin Lab 4 years ago
parent
commit
90a74e0792
  1. 49
      rocketchat/README.org

49
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.
take care of migrating database on startup.
Loading…
Cancel
Save