Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that in the event of a tie between "release pockets", we prefer non-innovation #1057

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading