Skip to content

Commit 9f79103

Browse files
authored
Merge pull request #554 from infosiftr/tip-arches
Fix "tip" arches (and set "latest" alias automatically)
2 parents 2a49384 + e3086cb commit 9f79103

File tree

3 files changed

+209
-190
lines changed

3 files changed

+209
-190
lines changed

Diff for: generate-stackbrew-library.sh

+16-5
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@
22
set -Eeuo pipefail
33

44
declare -A aliases=(
5-
[1.24]='1 latest'
5+
#[1.24]='1 latest'
66
)
77

8+
# because we sort in versions.sh, we can assume the first non-rc in versions.json is the "latest" release
9+
latest="$(jq -r 'first(keys_unsorted - ["tip"] | .[] | select(endswith("-rc") | not))' versions.json)"
10+
[ -n "$latest" ]
11+
aliases["$latest"]+=' 1 latest'
12+
export latest
13+
814
self="$(basename "$BASH_SOURCE")"
915
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
1016

1117
if [ "$#" -eq 0 ]; then
12-
versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)"
18+
versions="$(jq -r 'keys_unsorted | map(@sh) | join(" ")' versions.json)"
1319
eval "set -- $versions"
1420
fi
1521

16-
# sort version numbers with highest first
17-
IFS=$'\n'; set -- $(sort -rV <<<"$*"); unset IFS
22+
# no sort because we already sorted the keys in versions.sh (hence "keys_unsorted" above)
1823

1924
# get the most recent commit which modified any of "$@"
2025
fileCommit() {
@@ -139,7 +144,13 @@ for version; do
139144

140145
# cross-reference with supported architectures
141146
for arch in $variantArches; do
142-
if ! jq -e --arg arch "$arch" '.[env.version].arches[$arch].supported' versions.json &> /dev/null; then
147+
if ! jq -e --arg arch "$arch" '
148+
.[env.version].arches[$arch].supported
149+
# if the version we are checking is "tip", we need to cross-reference "latest" also (since it uses latest as GOROOT_BOOTSTRAP via COPY --from)
150+
and if env.version == "tip" then
151+
.[env.latest].arches[$arch].supported
152+
else true end
153+
' versions.json &> /dev/null; then
143154
variantArches="$(sed <<<" $variantArches " -e "s/ $arch / /g")"
144155
fi
145156
done

0 commit comments

Comments
 (0)