diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index c370158ef..9119eb29e 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -3,7 +3,6 @@ set -Eeuo pipefail declare -A aliases=( [8.4]='lts' - [innovation]='latest' ) defaultDefaultVariant='oracle' @@ -14,6 +13,10 @@ declare -A defaultVariants=( self="$(basename "$BASH_SOURCE")" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" +# add the "latest" alias to the "newest" version (LTS vs innovation; see sorting in "versions.sh") +latest="$(jq -r 'keys_unsorted[0]' versions.json)" +aliases["$latest"]+=' latest' + if [ "$#" -eq 0 ]; then versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" eval "set -- $versions" @@ -64,8 +67,18 @@ join() { for version; do export version - defaultVariant="${defaultVariants[$version]:-$defaultDefaultVariant}" - fullVersion="$(jq -r '.[env.version].version' versions.json)" + if ! fullVersion="$(jq -re ' + if env.version == "innovation" and keys_unsorted[0] != env.version then + # https://github.com/docker-library/mysql/pull/1046#issuecomment-2087323746 + # if any explicit/LTS release is *newer* than the current innovation release, we should skip innovation + # (because we pre-sorted the full list in "versions.sh", we just need to check whether "innovation" is first 🚀) + false + else + .[env.version].version + end + ' versions.json)"; then + continue + fi versionAliases=() while [ "$fullVersion" != "$version" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do @@ -78,6 +91,7 @@ for version; do fi versionAliases+=( ${aliases[$version]:-} ) + defaultVariant="${defaultVariants[$version]:-$defaultDefaultVariant}" for variant in oracle debian; do export variant diff --git a/versions.json b/versions.json index a5a5e0d9f..a1ad17ea0 100644 --- a/versions.json +++ b/versions.json @@ -1,57 +1,57 @@ { - "8.0": { - "debian": { - "architectures": [ - "amd64" - ], - "suite": "bookworm", - "version": "8.0.37-1debian12" - }, - "mysql-shell": { - "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/8", - "version": "8.0.37-1.el8" - }, + "8.4": { "oracle": { "architectures": [ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8", - "variant": "8-slim", - "version": "8.0.37-1.el8" + "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/8", + "version": "8.4.0-1.el8", + "variant": "8-slim" }, - "version": "8.0.37" - }, - "8.4": { "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/8", "version": "8.4.0-1.el8" }, + "version": "8.4.0" + }, + "innovation": { "oracle": { "architectures": [ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/8", - "variant": "8-slim", - "version": "8.4.0-1.el8" + "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8", + "version": "8.3.0-1.el8", + "variant": "8-slim" }, - "version": "8.4.0" - }, - "innovation": { "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8", "version": "8.4.0-1.el8" }, + "version": "8.3.0" + }, + "8.0": { + "version": "8.0.37", + "debian": { + "architectures": [ + "amd64" + ], + "suite": "bookworm", + "version": "8.0.37-1debian12" + }, "oracle": { "architectures": [ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8", - "variant": "8-slim", - "version": "8.3.0-1.el8" + "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8", + "version": "8.0.37-1.el8", + "variant": "8-slim" }, - "version": "8.3.0" + "mysql-shell": { + "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/8", + "version": "8.0.37-1.el8" + } } } diff --git a/versions.sh b/versions.sh index 10aaa1ae2..8c0f57ebd 100755 --- a/versions.sh +++ b/versions.sh @@ -172,4 +172,16 @@ for version in "${versions[@]}"; do json="$(jq <<<"$json" -c --argjson doc "$doc" '.[env.version] = $doc')" done -jq <<<"$json" -S . > versions.json +jq <<<"$json" ' + # sort entries in descending version order so that it is easier to determine later (in "generate-stackbrew-library.sh") if "innovation" should be included or not, and which entry to give the "latest" alias to (the first one!) + # https://github.com/docker-library/mysql/pull/1046#issuecomment-2087323746 + to_entries + | sort_by( + # very rough "sort by version number" + .value.version + | split(".") + | map(tonumber? // .) + ) + | reverse + | from_entries +' > versions.json