From 6faf41e2e9d9d0a2b97d83449830ca75cbee17f9 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 9 May 2024 14:03:01 -0700 Subject: [PATCH] Make sure that in the event of a tie between "release pockets", we prefer non-innovation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now, we're in the unique situation of "innovation" containing 8.4.0 just like "8.4" does, but we want to prefer the "lts" branch (and add the "innovation" alias to it 👀). --- generate-stackbrew-library.sh | 5 +++++ versions.sh | 15 +++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 16e8b1c5f..485cbb5b0 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -16,6 +16,11 @@ 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 "innovation" currently is in line with an LTS, add the "innovation" alias to the LTS release +innovation="$(jq -r 'to_entries | if .[0].value.version == .[1].value.version and .[1].key == "innovation" then .[0].key else "innovation" end' versions.json)" +if [ "$innovation" != 'innovation' ]; then + aliases["$innovation"]+=' innovation' +fi if [ "$#" -eq 0 ]; then versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" diff --git a/versions.sh b/versions.sh index cb73b25ef..3b0823e97 100755 --- a/versions.sh +++ b/versions.sh @@ -177,10 +177,17 @@ jq <<<"$json" ' # 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? // .) + [ + ( + # very rough "sort by version number" + .value.version + | split(".") + | map(tonumber? // .) + ), + # when two versions are equal (8.4.0 copied to "innovation" *and* in "8.4", for example), prefer the LTS/explicit release over "innovation" + .key != "innovation" + # (false sorts above true, but then we reverse) + ] ) | reverse | from_entries