Skip to content

Commit 6faf41e

Browse files
committed
Make sure that in the event of a tie between "release pockets", we prefer non-innovation
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 👀).
1 parent e384941 commit 6faf41e

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

generate-stackbrew-library.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
1616
# add the "latest" alias to the "newest" version (LTS vs innovation; see sorting in "versions.sh")
1717
latest="$(jq -r 'keys_unsorted[0]' versions.json)"
1818
aliases["$latest"]+=' latest'
19+
# if "innovation" currently is in line with an LTS, add the "innovation" alias to the LTS release
20+
innovation="$(jq -r 'to_entries | if .[0].value.version == .[1].value.version and .[1].key == "innovation" then .[0].key else "innovation" end' versions.json)"
21+
if [ "$innovation" != 'innovation' ]; then
22+
aliases["$innovation"]+=' innovation'
23+
fi
1924

2025
if [ "$#" -eq 0 ]; then
2126
versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)"

versions.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,17 @@ jq <<<"$json" '
177177
# https://github.com/docker-library/mysql/pull/1046#issuecomment-2087323746
178178
to_entries
179179
| sort_by(
180-
# very rough "sort by version number"
181-
.value.version
182-
| split(".")
183-
| map(tonumber? // .)
180+
[
181+
(
182+
# very rough "sort by version number"
183+
.value.version
184+
| split(".")
185+
| map(tonumber? // .)
186+
),
187+
# when two versions are equal (8.4.0 copied to "innovation" *and* in "8.4", for example), prefer the LTS/explicit release over "innovation"
188+
.key != "innovation"
189+
# (false sorts above true, but then we reverse)
190+
]
184191
)
185192
| reverse
186193
| from_entries

0 commit comments

Comments
 (0)