Skip to content

Commit

Permalink
Merge pull request #1057 from infosiftr/innovation-alias
Browse files Browse the repository at this point in the history
Make sure that in the event of a tie between "release pockets", we prefer non-innovation
  • Loading branch information
tianon authored May 9, 2024
2 parents e384941 + 6faf41e commit 02a10b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
15 changes: 11 additions & 4 deletions versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 02a10b3

Please sign in to comment.