From dbb5ff3047bbbdd802a0a1f6339b0e0c8b2bde06 Mon Sep 17 00:00:00 2001 From: Matt Bowersox Date: Thu, 19 Oct 2023 11:17:44 -0500 Subject: [PATCH] Test with Java 21 (#422) * Test with Java 21 * Check docker and podman versions when setIsDocker() is called * Use Podman if Docker not found --- .github/workflows/maven.yml | 4 ++-- .../util/AbstractContainerSupportUtil.java | 20 +++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 49e56173..53266c2b 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -19,7 +19,7 @@ jobs: matrix: # test against latest update of each major Java version, as well as specific updates of LTS versions: os: [ ubuntu-latest, windows-latest ] - java: [ 8, 11, 17 ] + java: [ 8, 11, 17, 21 ] steps: - name: Checkout ci.common @@ -37,6 +37,6 @@ jobs: cache: 'maven' - name: Install ci.ant run: | - ./mvnw -V clean install -f ci.ant + ./mvnw -V clean install -f ci.ant -DskipTests - name: Build and run tests run: ./mvnw -V clean install diff --git a/src/main/java/io/openliberty/tools/common/plugins/util/AbstractContainerSupportUtil.java b/src/main/java/io/openliberty/tools/common/plugins/util/AbstractContainerSupportUtil.java index fd650f25..0079cbae 100644 --- a/src/main/java/io/openliberty/tools/common/plugins/util/AbstractContainerSupportUtil.java +++ b/src/main/java/io/openliberty/tools/common/plugins/util/AbstractContainerSupportUtil.java @@ -51,6 +51,17 @@ public abstract class AbstractContainerSupportUtil { */ public abstract void info(String msg); + public void setIsDocker(boolean isDocker) throws PluginExecutionException { + this.isDocker = isDocker; + this.checkedContainerType = true; + + if (this.isDocker) { + checkDockerVersion(); + } else { + checkPodmanVersion(); + } + } + protected String getContainerCommandPrefix() throws PluginExecutionException { if (!checkedContainerType) { checkDockerVersion(); @@ -79,8 +90,11 @@ protected boolean checkDockerVersion() throws PluginExecutionException { throw new PluginExecutionException("The detected Docker client version number is not supported:" + dockerVersion.trim() + ". Docker version must be " + MIN_DOCKER_VERSION + " or higher."); } } - isDocker = true; - checkedContainerType = true; + + if (!checkedContainerType) { + isDocker = true; + checkedContainerType = true; + } return true; } @@ -96,8 +110,10 @@ private boolean checkPodmanVersion() throws PluginExecutionException { if (VersionUtility.compareArtifactVersion(podmanVersion, MIN_PODMAN_VERSION, false) < 0) { throw new PluginExecutionException("The detected Podman client version number is not supported:" + podmanVersion.trim() + ". Podman version must be " + MIN_PODMAN_VERSION + " or higher."); } + isDocker = false; checkedContainerType = true; + return true; }