fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.2 KiB

  1. # -*- ispell-local-dictionary: "english" -*-
  2. #+SETUPFILE: ~/.emacs.d/etc/setup/latex.setup
  3. #+SETUPFILE: ~/.emacs.d/etc/setup/html-readtheorg-local.setup
  4. #+TITLE: Rocket.Chat
  5. * Updating the charm to a new version
  6. We are using official image. Latest tags usually. You can
  7. double-check available candidate for official images like this:
  8. #+begin_src sh
  9. docker search rocket.chat
  10. #+end_src
  11. So we usually pull and test images like this :
  12. #+begin_src sh
  13. docker pull rocket.chat:X.Y.Z
  14. #+end_src
  15. This worked on 3.6.3, but changed before 3.8.0 to:
  16. #+begin_src sh
  17. docker pull rocketchat/rocket.chat:X.Y.Z
  18. #+end_src
  19. from: https://hub.docker.com/r/rocketchat/rocket.chat
  20. Get the available tags:
  21. #+begin_src sh
  22. IMAGE_BASE_NAME=rocket.chat
  23. ## lookup on docker hub only. Could think doing it for any docker
  24. ## image identifier available on `pull`. This would mean querying
  25. ## other registries, probably with a different api.
  26. docker:lookup_available_tags() {
  27. local image="$1" limit="${2:-10}" filter="$3" eor p
  28. ## remove any tags on image name
  29. image="${image%%:*}"
  30. if [[ "$image" == *"/"* ]]; then
  31. username="${image%%/*}"
  32. image="${image##*/}"
  33. else
  34. username="library"
  35. fi
  36. p=0
  37. eor=
  38. while [ -z "$eor" ]; do
  39. ((p++))
  40. out=$(curl -s "https://registry.hub.docker.com/v2/repositories/$username/$image/tags/?page=$p" |
  41. jq -r '."results"[]["name"]') || break
  42. [ -z "$out" ] && break
  43. ## 10 results are expected per request, otherwise
  44. ## this means we are hitting End of Records.
  45. nb_result=$(printf "%s\n" "$out" | wc -l)
  46. [ "$nb_result" -lt 10 ] && eor=true
  47. ## filter records
  48. [ "$filter" ] && out=$(printf "%s\n" "$out" | egrep "$filter")
  49. [ -z "$out" ] && continue
  50. nb_result=$(printf "%s\n" "$out" | wc -l)
  51. if [ "$limit" -le "$nb_result" ]; then
  52. printf "%s\n" "$out" | head -n "$limit"
  53. break
  54. fi
  55. printf "%s\n" "$out"
  56. limit=$((limit - nb_result))
  57. done
  58. }
  59. docker:lookup_available_tags rocketchat/rocket.chat 15 "^[0-9]+(\.[0-9]+)*$"
  60. #+end_src
  61. Rocket.chat has a powerfull and working update database that will
  62. take care of migrating database on startup.