Skip to content

Commit

Permalink
fixup! Add Java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Sep 23, 2023
1 parent d8bae60 commit 336c64a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 43 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ jobs:
run: |
set -xeuo pipefail
. ./settings.sh
./bin/build.sh
if [ "${JDK_VERSION}" = "java17" ] || [ "${JDK_VERSION}" = "java20" ]; then
./bin/build-old.sh
else
./bin/build.sh
fi
docker image ls
env:
JDK_VERSION: ${{ matrix.jdk_version }}
Expand Down
45 changes: 45 additions & 0 deletions bin/build-old.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

set -xeuo pipefail

docker pull "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}" || true
docker pull "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" || true
docker pull "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" || true

docker build \
--pull `#base is public, make sure to use the latest greatest` \
--file Dockerfile \
--build-arg "JDK_VERSION=${JDK_VERSION}" \
--build-arg "GRAAL_JDK_VERSION=${GRAAL_JDK_VERSION}" \
--cache-from "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}" \
--tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}" \
.

docker build \
--file Dockerfile.native \
--build-arg "GRAAL_VERSION=${GRAAL_VERSION}" \
--build-arg "JDK_VERSION=${JDK_VERSION}" \
--cache-from "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" \
--tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" \
.

docker build \
--file Dockerfile.polyglot \
--build-arg "GRAAL_VERSION=${GRAAL_VERSION}" \
--build-arg "JDK_VERSION=${JDK_VERSION}" \
--cache-from "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" \
--tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" \
.

docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}" "${IMAGE_NAME}:${JDK_VERSION}"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" "${IMAGE_NAME}:${JDK_VERSION}-native"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-all"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" "${IMAGE_NAME}:${JDK_VERSION}-polyglot"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" "${IMAGE_NAME}:${JDK_VERSION}-all"

if [ "${DEFAULT_IMAGE}" = "true" ]; then
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}" "${IMAGE_NAME}:latest"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" "${IMAGE_NAME}:native"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" "${IMAGE_NAME}:polyglot"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-all" "${IMAGE_NAME}:all"
fi
49 changes: 10 additions & 39 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,29 @@

set -xeuo pipefail

docker pull "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}" || true
docker pull "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" || true
docker pull "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" || true
docker pull "${IMAGE_NAME}:${JDK_VERSION}" || true
docker pull "${IMAGE_NAME}:${JDK_VERSION}-native" || true

docker build \
--pull `#base is public, make sure to use the latest greatest` \
--file Dockerfile \
--build-arg "JDK_VERSION=${JDK_VERSION}" \
--build-arg "GRAAL_JDK_VERSION=${GRAAL_JDK_VERSION}" \
--cache-from "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}" \
--tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}" \
--cache-from "${IMAGE_NAME}:${JDK_VERSION}" \
--tag "${IMAGE_NAME}:${JDK_VERSION}" \
.

docker build \
--file Dockerfile.native \
--build-arg "GRAAL_VERSION=${GRAAL_VERSION}" \
--build-arg "JDK_VERSION=${JDK_VERSION}" \
--cache-from "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" \
--tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" \
--cache-from "${IMAGE_NAME}:${JDK_VERSION}-native" \
--tag "${IMAGE_NAME}:${JDK_VERSION}-native" \
.

# 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 [ "${JDK_VERSION}" != "java21" ]; then
docker build \
--file Dockerfile.polyglot \
--build-arg "GRAAL_VERSION=${GRAAL_VERSION}" \
--build-arg "JDK_VERSION=${JDK_VERSION}" \
--cache-from "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" \
--tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" \
.
fi

docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}" "${IMAGE_NAME}:${JDK_VERSION}"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" "${IMAGE_NAME}:${JDK_VERSION}-native"

if [ "${JDK_VERSION}" != "java21" ]; then
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-all"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" "${IMAGE_NAME}:${JDK_VERSION}-polyglot"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" "${IMAGE_NAME}:${JDK_VERSION}-all"
else
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-all"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" "${IMAGE_NAME}:${JDK_VERSION}-all"
fi
docker tag "${IMAGE_NAME}:${JDK_VERSION}-native" "${IMAGE_NAME}:${JDK_VERSION}-all"

if [ "${DEFAULT_IMAGE}" = "true" ]; then
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}" "${IMAGE_NAME}:latest"
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-native" "${IMAGE_NAME}:native"
if [ "${JDK_VERSION}" != "java21" ]; then
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-polyglot" "${IMAGE_NAME}:polyglot"
fi
docker tag "${IMAGE_NAME}:${GRAAL_VERSION}-${JDK_VERSION}-all" "${IMAGE_NAME}:all"
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}-all" "${IMAGE_NAME}:all"
fi
6 changes: 4 additions & 2 deletions bin/test-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ docker run --rm "${image}" java -version 2>&1 | grep GraalVM
docker run --rm "${image}" java -version 2>&1 | grep "openjdk version \"${JDK_VERSION#java}."
docker run --rm "${image}" bash -c '$JAVA_HOME/bin/java -version' 2>&1 | tee /dev/stderr | grep GraalVM

# Verify GRAAL_VERSION matches what we built
docker run --rm -i "${image}" polyglot --version | tee /dev/stderr | grep -xF "GraalVM CE polyglot launcher ${GRAAL_VERSION}"
if test -v GRAAL_VERSION; then
# Verify GRAAL_VERSION matches what we built
docker run --rm -i "${image}" polyglot --version | tee /dev/stderr | grep -xF "GraalVM CE polyglot launcher ${GRAAL_VERSION}"
fi
5 changes: 4 additions & 1 deletion settings.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
#!bash

export IMAGE_NAME=findepi/graalvm # by necessity, this is also set in derived images' FROM directive
export GRAAL_VERSION="23.0.1"
GRAAL_VERSION="23.0.1"
export JDK_VERSION="${JDK_VERSION-java17}"
export DEFAULT_IMAGE="${DEFAULT_IMAGE-false}"

if [ "${JDK_VERSION}" = "java17" ]; then
GRAAL_JDK_VERSION="17.0.8"
export GRAAL_VERSION
elif [ "${JDK_VERSION}" = "java20" ]; then
GRAAL_JDK_VERSION="20.0.2"
export GRAAL_VERSION
elif [ "${JDK_VERSION}" = "java21" ]; then
GRAAL_JDK_VERSION="21.0.0"
unset GRAAL_VERSION # unverifiable
else
echo "Unknown JDK_VERSION ${JDK_VERSION}" >&2
exit 1
Expand Down

0 comments on commit 336c64a

Please sign in to comment.