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.

36 lines
907 B

  1. #!/bin/bash
  2. ## List upstream available versions in reverse chronological order
  3. ##
  4. ## These versions information will be the input for the version information
  5. ## usually used by the build process.
  6. ## A external query of upstream sources will be done.
  7. ##
  8. ## This script is launched by ``charm upstream-versions`` and will receive these env variables
  9. ##
  10. ##
  11. ## VERSION_LIMIT ## limit number of version to read
  12. ##
  13. ##
  14. ## The script CWD will be the root of the charm directory
  15. ##
  16. DOCKER_IMAGE_NAME=mongo
  17. semver:normalize() {
  18. local upstream_version="$1"
  19. echo "$upstream_version"
  20. }
  21. upstream:list() {
  22. local limit=${1:-5}
  23. docker-tags-fetch "$DOCKER_IMAGE_NAME" -l "${limit}" -f "^[0-9]+\.[0-9]+\.[0-9]+$" |
  24. sort -rV
  25. }
  26. while read -r "upstream_version"; do
  27. printf "%s %s\n" "$(semver:normalize "${upstream_version}")" "$upstream_version"
  28. done < <(upstream:list "${VERSION_LIMIT}")