Skip to content

Commit

Permalink
Add Java 21
Browse files Browse the repository at this point in the history
With Java 21, Graal changed how language runtimes are distributed and
removed `gu` installation tool.  While it's possible to provide
equivalent functionality (e.g. `pyenv install graalpy-community-23.1.0`
for Python), it not necessarily makes sense (bigger image). For now,
don't build polyglot for Java 21.
  • Loading branch information
findepi committed Sep 23, 2023
1 parent 272d43b commit c57d19d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 16 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
default_image: true
- jdk_version: java20
default_image: false
- jdk_version: java21
default_image: false
timeout-minutes: 45
steps:
- uses: actions/checkout@v2
Expand All @@ -33,7 +35,9 @@ jobs:
. ./settings.sh
./bin/test-base.sh
./bin/test-native.sh
./bin/test-polyglot.sh
if "${BUILD_POLYGLOT}"; then
./bin/test-polyglot.sh
fi
env:
JDK_VERSION: ${{ matrix.jdk_version }}
DEFAULT_IMAGE: ${{ matrix.default_image }}
Expand Down
36 changes: 25 additions & 11 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ set -xeuo pipefail

docker pull "${IMAGE_NAME}:${JDK_VERSION}" || true
docker pull "${IMAGE_NAME}:${JDK_VERSION}-native" || true
docker pull "${IMAGE_NAME}:${JDK_VERSION}-polyglot" || true
if "${BUILD_POLYGLOT}"; then
docker pull "${IMAGE_NAME}:${JDK_VERSION}-polyglot" || true
fi

docker build \
--pull `#base is public, make sure to use the latest greatest` \
Expand All @@ -22,21 +24,33 @@ docker build \
--tag "${IMAGE_NAME}:${JDK_VERSION}-native" \
.

docker build \
--file Dockerfile.polyglot \
--build-arg "JDK_VERSION=${JDK_VERSION}" \
--cache-from "${IMAGE_NAME}:${JDK_VERSION}-polyglot" \
--tag "${IMAGE_NAME}:${JDK_VERSION}-polyglot" \
.
# Polyglot image depends on `gu` which is removed from Java21. While it's possible
# to provide equivalent functionality (e.g. `pyenv install graalpy-community-23.1.0`
# for Python), it not necessarily makes sense (bigger image). For now, don't build
# polyglot.
if "${BUILD_POLYGLOT}"; then
docker build \
--file Dockerfile.polyglot \
--build-arg "JDK_VERSION=${JDK_VERSION}" \
--cache-from "${IMAGE_NAME}:${JDK_VERSION}-polyglot" \
--tag "${IMAGE_NAME}:${JDK_VERSION}-polyglot" \
.
fi

docker tag "${IMAGE_NAME}:${JDK_VERSION}" "${IMAGE_NAME}:${JDK_VERSION}"
docker tag "${IMAGE_NAME}:${JDK_VERSION}-native" "${IMAGE_NAME}:${JDK_VERSION}-native"
docker tag "${IMAGE_NAME}:${JDK_VERSION}-polyglot" "${IMAGE_NAME}:${JDK_VERSION}-polyglot"
docker tag "${IMAGE_NAME}:${JDK_VERSION}-polyglot" "${IMAGE_NAME}:${JDK_VERSION}-all"
if "${BUILD_POLYGLOT}"; then
docker tag "${IMAGE_NAME}:${JDK_VERSION}-polyglot" "${IMAGE_NAME}:${JDK_VERSION}-polyglot"
# When there is no polyglot image, the "all" image does not make much sense.
docker tag "${IMAGE_NAME}:${JDK_VERSION}-polyglot" "${IMAGE_NAME}:${JDK_VERSION}-all"
fi

if [ "${DEFAULT_IMAGE}" = "true" ]; then
docker tag "${IMAGE_NAME}:${JDK_VERSION}" "${IMAGE_NAME}:latest"
docker tag "${IMAGE_NAME}:${JDK_VERSION}-native" "${IMAGE_NAME}:native"
docker tag "${IMAGE_NAME}:${JDK_VERSION}-polyglot" "${IMAGE_NAME}:polyglot"
docker tag "${IMAGE_NAME}:${JDK_VERSION}-all" "${IMAGE_NAME}:all"
if "${BUILD_POLYGLOT}"; then
docker tag "${IMAGE_NAME}:${JDK_VERSION}-polyglot" "${IMAGE_NAME}:polyglot"
# When there is no polyglot image, the "all" image does not make much sense.
docker tag "${IMAGE_NAME}:${JDK_VERSION}-all" "${IMAGE_NAME}:all"
fi
fi
14 changes: 10 additions & 4 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ set +v -x

docker push "${IMAGE_NAME}:${JDK_VERSION}"
docker push "${IMAGE_NAME}:${JDK_VERSION}-native"
docker push "${IMAGE_NAME}:${JDK_VERSION}-polyglot"
docker push "${IMAGE_NAME}:${JDK_VERSION}-all"
if "${BUILD_POLYGLOT}"; then
docker push "${IMAGE_NAME}:${JDK_VERSION}-polyglot"
# When there is no polyglot image, the "all" image does not make much sense.
docker push "${IMAGE_NAME}:${JDK_VERSION}-all"
fi

if [ "${DEFAULT_IMAGE}" = "true" ]; then
docker push "${IMAGE_NAME}:latest"
docker push "${IMAGE_NAME}:native"
docker push "${IMAGE_NAME}:polyglot"
docker push "${IMAGE_NAME}:all"
if "${BUILD_POLYGLOT}"; then
docker push "${IMAGE_NAME}:polyglot"
# When there is no polyglot image, the "all" image does not make much sense.
docker push "${IMAGE_NAME}:all"
fi
fi
6 changes: 6 additions & 0 deletions settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ export DEFAULT_IMAGE="${DEFAULT_IMAGE-false}"

if [ "${JDK_VERSION}" = "java17" ]; then
GRAAL_JDK_VERSION="17.0.8"
BUILD_POLYGLOT=true
elif [ "${JDK_VERSION}" = "java20" ]; then
GRAAL_JDK_VERSION="20.0.2"
BUILD_POLYGLOT=true
elif [ "${JDK_VERSION}" = "java21" ]; then
GRAAL_JDK_VERSION="21.0.0"
BUILD_POLYGLOT=false
else
echo "Unknown JDK_VERSION ${JDK_VERSION}" >&2
exit 1
fi
export GRAAL_JDK_VERSION
export BUILD_POLYGLOT

0 comments on commit c57d19d

Please sign in to comment.