Skip to content

Commit

Permalink
ci(gameserver): build with multiple JDK versions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Jul 23, 2024
1 parent cda8fb8 commit 88cd6d3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gameserver/Containerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG server_img=docker.io/itzg/minecraft-server:java21-jdk
ARG server_img=docker.io/itzg/minecraft-server:java21
ARG agent_version

FROM quay.io/cryostat/cryostat-agent-init:${agent_version} AS agent
Expand Down
24 changes: 17 additions & 7 deletions gameserver/build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,31 @@ trap cleanup EXIT
BUILD_IMG="${APP_REGISTRY:-quay.io}/${APP_NAMESPACE:-redhat-java-monitoring}/${APP_NAME:-gameserver-cryostat-agent}"
BUILD_TAG="${APP_VERSION:-latest}"
CRYOSTAT_AGENT_VERSION="${CRYOSTAT_AGENT_VERSION:-0.5.0-SNAPSHOT}"
IFS=', ' read -r -a ARCHS <<< "${IMAGE_ARCHS:-amd64 arm64}"
IFS=', ' read -r -a JDKS <<< "${JDK_VERSIONS:-11 17 21}"

podman manifest create "${BUILD_IMG}:${BUILD_TAG}"
for jdk in "${JDKS[@]}"; do
podman manifest create "${BUILD_IMG}:${BUILD_TAG}-jdk${jdk}"
done

for arch in amd64 arm64; do
echo "Building for ${arch} ..."
podman build --build-arg agent_version="${CRYOSTAT_AGENT_VERSION,,}" --platform="linux/${arch}" -t "${BUILD_IMG}:linux-${arch}" -f "${DIR}/Containerfile" "${DIR}"
podman manifest add "${BUILD_IMG}:${BUILD_TAG}" containers-storage:"${BUILD_IMG}:linux-${arch}"
for arch in "${ARCHS[@]}"; do
for jdk in "${JDKS[@]}"; do
echo "Building JDK ${jdk} for ${arch} ..."
podman build --build-arg server_img="docker.io/itzg/minecraft-server:java${jdk}" --build-arg agent_version="${CRYOSTAT_AGENT_VERSION,,}" --platform="linux/${arch}" -t "${BUILD_IMG}:linux-${arch}-jdk${jdk}" -f "${DIR}/Containerfile" "${DIR}"
podman manifest add "${BUILD_IMG}:${BUILD_TAG}-jdk${jdk}" containers-storage:"${BUILD_IMG}:linux-${arch}-jdk${jdk}"
done
done

for tag in ${TAGS}; do
podman tag "${BUILD_IMG}:${BUILD_TAG}" "${BUILD_IMG}:${tag}"
for jdk in "${JDKS[@]}"; do
podman tag "${BUILD_IMG}:${BUILD_TAG}-jdk${jdk}" "${BUILD_IMG}:${tag}-jdk${jdk}"
done
done

if [ "${PUSH_MANIFEST}" = "true" ]; then
for tag in ${TAGS}; do
podman manifest push "${BUILD_IMG}:${tag}" "docker://${BUILD_IMG}:${tag}"
for jdk in "${JDKS[@]}"; do
podman manifest push "${BUILD_IMG}:${tag}-jdk${jdk}" "docker://${BUILD_IMG}:${tag}-jdk${jdk}"
done
done
fi

0 comments on commit 88cd6d3

Please sign in to comment.