Skip to content

Commit 69d0d40

Browse files
committed
refactor(versions): shorten list of supported base container versions/variants
There's no reason to target Python versions/variants not used in practice. This filters out all but the latest Python release on Alpine Linux 3.16 or Debian "Bullseye" (including the slimmed-down variant). Other versions or variants can always be added later should there be demand for them.
1 parent a345f3d commit 69d0d40

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

versions.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ else
1616
fi
1717
versions=( "${versions[@]%/}" )
1818

19-
# grab list of Python container images, filtering out unsupported variants
20-
variants=$(
19+
# determine latest Python container version and supported variants
20+
eval $(
2121
curl -s https://raw.githubusercontent.com/docker-library/python/master/versions.json \
22-
| jq -r 'keys[] as $k | .[$k].variants | map("py\($k)-\(.)") | .[]' \
23-
| grep -v windows
24-
)
25-
export variants
22+
| jq -r '
23+
. as $versions
24+
| [ $versions|keys[] | select(contains("-rc") | not) ] | sort_by(split(".") | map(tonumber)) | last as $latest
25+
| [ $versions | .[$latest].variants[] | select(test("alpine3.16|bullseye")) ] | join(" ") as $variants
26+
| @sh "export python_version=\($latest) variants=\($variants)"
27+
'
28+
)
2629

2730
for version in "${versions[@]}"; do
2831
export version
@@ -45,8 +48,9 @@ for version in "${versions[@]}"; do
4548
export fullVersion
4649
json="$(jq <<<"$json" -c '
4750
.[env.version] = {
48-
variants: env.variants | split("\n"),
51+
variants: env.variants | split(" "),
4952
version: env.fullVersion,
53+
python_version: env.python_version,
5054
}
5155
')"
5256
done

0 commit comments

Comments
 (0)