Skip to content

Commit 784047f

Browse files
committed
Skip "innovation" when any other release is newer
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.
1 parent 53973fa commit 784047f

File tree

3 files changed

+58
-32
lines changed

3 files changed

+58
-32
lines changed

generate-stackbrew-library.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ set -Eeuo pipefail
33

44
declare -A aliases=(
55
[8.4]='lts'
6-
[innovation]='latest'
76
)
87

98
defaultDefaultVariant='oracle'
@@ -14,6 +13,10 @@ declare -A defaultVariants=(
1413
self="$(basename "$BASH_SOURCE")"
1514
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
1615

16+
# add the "latest" alias to the "newest" version (LTS vs innovation; see sorting in "versions.sh")
17+
latest="$(jq -r 'keys_unsorted[0]' versions.json)"
18+
aliases["$latest"]+=' latest'
19+
1720
if [ "$#" -eq 0 ]; then
1821
versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)"
1922
eval "set -- $versions"
@@ -64,8 +67,18 @@ join() {
6467
for version; do
6568
export version
6669

67-
defaultVariant="${defaultVariants[$version]:-$defaultDefaultVariant}"
68-
fullVersion="$(jq -r '.[env.version].version' versions.json)"
70+
if ! fullVersion="$(jq -re '
71+
if env.version == "innovation" and keys_unsorted[0] != env.version then
72+
# https://github.com/docker-library/mysql/pull/1046#issuecomment-2087323746
73+
# if any explicit/LTS release is *newer* than the current innovation release, we should skip innovation
74+
# (because we pre-sorted the full list in "versions.sh", we just need to check whether "innovation" is first 🚀)
75+
false
76+
else
77+
.[env.version].version
78+
end
79+
' versions.json)"; then
80+
continue
81+
fi
6982

7083
versionAliases=()
7184
while [ "$fullVersion" != "$version" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do
@@ -78,6 +91,7 @@ for version; do
7891
fi
7992
versionAliases+=( ${aliases[$version]:-} )
8093

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

versions.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
{
2-
"8.0": {
3-
"debian": {
4-
"architectures": [
5-
"amd64"
6-
],
7-
"suite": "bookworm",
8-
"version": "8.0.37-1debian12"
9-
},
10-
"mysql-shell": {
11-
"repo": "https://repo.mysql.com/yum/mysql-tools-community/el/8",
12-
"version": "8.0.37-1.el8"
13-
},
2+
"8.4": {
143
"oracle": {
154
"architectures": [
165
"amd64",
176
"arm64v8"
187
],
19-
"repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8",
20-
"variant": "8-slim",
21-
"version": "8.0.37-1.el8"
8+
"repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/8",
9+
"version": "8.4.0-1.el8",
10+
"variant": "8-slim"
2211
},
23-
"version": "8.0.37"
24-
},
25-
"8.4": {
2612
"mysql-shell": {
2713
"repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/8",
2814
"version": "8.4.0-1.el8"
2915
},
16+
"version": "8.4.0"
17+
},
18+
"innovation": {
3019
"oracle": {
3120
"architectures": [
3221
"amd64",
3322
"arm64v8"
3423
],
35-
"repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/8",
36-
"variant": "8-slim",
37-
"version": "8.4.0-1.el8"
24+
"repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8",
25+
"version": "8.3.0-1.el8",
26+
"variant": "8-slim"
3827
},
39-
"version": "8.4.0"
40-
},
41-
"innovation": {
4228
"mysql-shell": {
4329
"repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8",
4430
"version": "8.4.0-1.el8"
4531
},
32+
"version": "8.3.0"
33+
},
34+
"8.0": {
35+
"version": "8.0.37",
36+
"debian": {
37+
"architectures": [
38+
"amd64"
39+
],
40+
"suite": "bookworm",
41+
"version": "8.0.37-1debian12"
42+
},
4643
"oracle": {
4744
"architectures": [
4845
"amd64",
4946
"arm64v8"
5047
],
51-
"repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8",
52-
"variant": "8-slim",
53-
"version": "8.3.0-1.el8"
48+
"repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8",
49+
"version": "8.0.37-1.el8",
50+
"variant": "8-slim"
5451
},
55-
"version": "8.3.0"
52+
"mysql-shell": {
53+
"repo": "https://repo.mysql.com/yum/mysql-tools-community/el/8",
54+
"version": "8.0.37-1.el8"
55+
}
5656
}
5757
}

versions.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,16 @@ for version in "${versions[@]}"; do
172172
json="$(jq <<<"$json" -c --argjson doc "$doc" '.[env.version] = $doc')"
173173
done
174174

175-
jq <<<"$json" -S . > versions.json
175+
jq <<<"$json" '
176+
# 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!)
177+
# https://github.com/docker-library/mysql/pull/1046#issuecomment-2087323746
178+
to_entries
179+
| sort_by(
180+
# very rough "sort by version number"
181+
.value.version
182+
| split(".")
183+
| map(tonumber? // .)
184+
)
185+
| reverse
186+
| from_entries
187+
' > versions.json

0 commit comments

Comments
 (0)