Skip to content

Commit 9b03964

Browse files
committed
Separate used Temurin release name from .java-version
1 parent d511fd6 commit 9b03964

File tree

2 files changed

+13
-28
lines changed

2 files changed

+13
-28
lines changed

.temurin-release

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
jdk-22+36

core/docker/build.sh

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ SOURCE_DIR="${SCRIPT_DIR}/../.."
2222

2323
ARCHITECTURES=(amd64 arm64 ppc64le)
2424
TRINO_VERSION=
25-
JDK_VERSION=$(cat "${SOURCE_DIR}/.java-version")
26-
JDK_RELEASE=ga
2725

28-
while getopts ":a:h:r:j:" o; do
26+
# Must match https://api.adoptium.net/q/swagger-ui/#/Release%20Info/getReleaseNames
27+
TEMURIN_RELEASE=$(cat "${SOURCE_DIR}/.temurin-release")
28+
29+
while getopts ":a:h:r:t:" o; do
2930
case "${o}" in
3031
a)
3132
IFS=, read -ra ARCHITECTURES <<< "$OPTARG"
@@ -37,8 +38,8 @@ while getopts ":a:h:r:j:" o; do
3738
usage
3839
exit 0
3940
;;
40-
j)
41-
JDK_VERSION="${OPTARG}"
41+
t)
42+
TEMURIN_RELEASE="${OPTARG}"
4243
;;
4344
*)
4445
usage
@@ -55,26 +56,9 @@ function check_environment() {
5556
fi
5657
}
5758

58-
if [[ "${JDK_VERSION}" == *-ea ]]; then
59-
JDK_VERSION=${JDK_VERSION/-ea/}
60-
JDK_RELEASE="ea"
61-
fi
62-
63-
function temurin_jdk_link() {
64-
local JDK_VERSION="${1}"
65-
local JDK_RELEASE="${2}"
66-
local ARCH="${3}"
67-
68-
versionsUrl="https://api.adoptium.net/v3/info/release_names?heap_size=normal&image_type=jdk&os=linux&page=0&page_size=20&project=jdk&release_type=${JDK_RELEASE}&semver=false&sort_method=DEFAULT&sort_order=DESC&vendor=eclipse&version=%28${JDK_VERSION}%2C%5D"
69-
if ! result=$(curl -fLs "$versionsUrl" -H 'accept: application/json'); then
70-
echo >&2 "Failed to fetch release names for JDK version [${JDK_VERSION}, ) from Temurin API : $result"
71-
exit 1
72-
fi
73-
74-
if ! RELEASE_NAME=$(echo "$result" | jq -er '.releases[]' | grep "${JDK_VERSION}" | head -n 1); then
75-
echo >&2 "Failed to determine release name: ${RELEASE_NAME}"
76-
exit 1
77-
fi
59+
function temurin_download_link() {
60+
local RELEASE_NAME="${1}"
61+
local ARCH="${2}"
7862

7963
case "${ARCH}" in
8064
arm64)
@@ -123,13 +107,13 @@ cp -R default "${WORK_DIR}/"
123107
TAG_PREFIX="trino:${TRINO_VERSION}"
124108

125109
for arch in "${ARCHITECTURES[@]}"; do
126-
echo "🫙 Building the image for $arch with JDK ${JDK_VERSION} ${JDK_RELEASE}"
110+
echo "🫙 Building the image for $arch with Temurin Release ${TEMURIN_RELEASE}"
127111
docker build \
128112
"${WORK_DIR}" \
129113
--progress=plain \
130114
--pull \
131-
--build-arg JDK_VERSION="${JDK_VERSION}" \
132-
--build-arg JDK_DOWNLOAD_LINK="$(temurin_jdk_link "${JDK_VERSION}" "${JDK_RELEASE}" "${arch}")" \
115+
--build-arg JDK_VERSION="${TEMURIN_RELEASE}" \
116+
--build-arg JDK_DOWNLOAD_LINK="$(temurin_download_link "${TEMURIN_RELEASE}" "${arch}")" \
133117
--platform "linux/$arch" \
134118
-f Dockerfile \
135119
-t "${TAG_PREFIX}-$arch" \

0 commit comments

Comments
 (0)