Skip to content

Commit

Permalink
Skip "innovation" when any other release is newer
Browse files Browse the repository at this point in the history
We're in a temporary state where we have 8.4 as the freshly minted LTS and innovation still points to 8.3 (which is now "EOL") until 9.x -- this implementation ensures we bring innovation back automatically when it gets 9.x.

See also https://dev.mysql.com/blog-archive/introducing-mysql-innovation-and-long-term-support-lts-versions/ especially the final graphic.
  • Loading branch information
tianon committed Apr 30, 2024
1 parent 53973fa commit 784047f
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 32 deletions.
20 changes: 17 additions & 3 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ set -Eeuo pipefail

declare -A aliases=(
[8.4]='lts'
[innovation]='latest'
)

defaultDefaultVariant='oracle'
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -78,6 +91,7 @@ for version; do
fi
versionAliases+=( ${aliases[$version]:-} )

defaultVariant="${defaultVariants[$version]:-$defaultDefaultVariant}"
for variant in oracle debian; do
export variant

Expand Down
56 changes: 28 additions & 28 deletions versions.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
14 changes: 13 additions & 1 deletion versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 784047f

Please sign in to comment.