From ec107fa4f9466079b03118b9a35d1ba9f5d07ca1 Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Fri, 19 Jul 2024 09:55:09 +0200 Subject: [PATCH 1/7] Update gradle-oci to 0.11.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d07959f01..07c85baa6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -83,6 +83,6 @@ graalvm-native = { id = "org.graalvm.buildtools.native", version = "0.10.2" } launch4j = { id = "edu.sc.seis.launch4j", version = "3.0.6" } license = { id = "com.github.hierynomus.license", version = "0.16.1" } nebula-ospackage = { id = "com.netflix.nebula.ospackage", version = "11.9.1" } -oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.10.0" } +oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.11.0" } openapi-generator = { id = "org.openapi.generator", version = "4.3.1" } # >= 5.0.0 breaks the tasks shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" } From 63d5e4b3f15e2949d383f02f01c2f67f3cdfd290 Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Mon, 22 Jul 2024 11:15:04 +0200 Subject: [PATCH 2/7] Update gradle-oci to 0.12.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 07c85baa6..17f0cc9fe 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -83,6 +83,6 @@ graalvm-native = { id = "org.graalvm.buildtools.native", version = "0.10.2" } launch4j = { id = "edu.sc.seis.launch4j", version = "3.0.6" } license = { id = "com.github.hierynomus.license", version = "0.16.1" } nebula-ospackage = { id = "com.netflix.nebula.ospackage", version = "11.9.1" } -oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.11.0" } +oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.12.0" } openapi-generator = { id = "org.openapi.generator", version = "4.3.1" } # >= 5.0.0 breaks the tasks shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" } From 8d1ef527c1a9e34a9bc921f0e8a74335dad6e6b2 Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Tue, 23 Jul 2024 20:28:42 +0200 Subject: [PATCH 3/7] Update gradle-oci to 0.13.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 17f0cc9fe..c238c7fca 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -83,6 +83,6 @@ graalvm-native = { id = "org.graalvm.buildtools.native", version = "0.10.2" } launch4j = { id = "edu.sc.seis.launch4j", version = "3.0.6" } license = { id = "com.github.hierynomus.license", version = "0.16.1" } nebula-ospackage = { id = "com.netflix.nebula.ospackage", version = "11.9.1" } -oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.12.0" } +oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.13.0" } openapi-generator = { id = "org.openapi.generator", version = "4.3.1" } # >= 5.0.0 breaks the tasks shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" } From 7861310495727a4a2d7f019e515f46d0012aad9b Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Fri, 26 Jul 2024 17:32:28 +0200 Subject: [PATCH 4/7] Use gradle-oci for all images used in integration tests --- build.gradle.kts | 1 + .../swarm/commander/SwarmStatusCommandIT.java | 28 ++++++++--------- .../swarm/run/SwarmRunStartCommandIT.java | 31 +++++++++---------- .../swarm/run/SwarmRunStopCommandIT.java | 31 +++++++++---------- 4 files changed, 45 insertions(+), 46 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7ff79558c..e8a21e100 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -259,6 +259,7 @@ testing { ociImageDependencies { runtime("hivemq:hivemq4:latest") { isChanging = true } + runtime("hivemq:hivemq-swarm:latest") { isChanging = true } } } diff --git a/src/integrationTest/java/com/hivemq/cli/commands/swarm/commander/SwarmStatusCommandIT.java b/src/integrationTest/java/com/hivemq/cli/commands/swarm/commander/SwarmStatusCommandIT.java index d3c4ca6bc..d1617f417 100644 --- a/src/integrationTest/java/com/hivemq/cli/commands/swarm/commander/SwarmStatusCommandIT.java +++ b/src/integrationTest/java/com/hivemq/cli/commands/swarm/commander/SwarmStatusCommandIT.java @@ -23,6 +23,7 @@ import com.hivemq.cli.openapi.swarm.CommanderApi; import com.hivemq.cli.openapi.swarm.RunsApi; import com.hivemq.cli.utils.TestLoggerUtils; +import io.github.sgtsilvio.gradle.oci.junit.jupiter.OciImages; import okhttp3.OkHttpClient; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.AfterEach; @@ -44,23 +45,22 @@ public class SwarmStatusCommandIT { - //TODO: Temporary fix, see: https://github.com/testcontainers/testcontainers-java/pull/8302 - private static final @NotNull String IMAGE_NAME = "hivemq/hivemq-swarm:4.22.0"; private static final int REST_PORT = 8080; private final @NotNull Network network = Network.newNetwork(); - private final @NotNull GenericContainer swarm = new GenericContainer<>(IMAGE_NAME).withNetwork(network) - .withNetworkAliases("swarm") - .withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881") - .withEnv("SWARM_COMMANDER_MODE", "rest") - .withEnv("SWARM_REST_ENABLED", "true") - .withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true") - .withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT)) - .withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0") - .waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1)) - .withEnv("LOG_LEVEL", "DEBUG") - .withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String())) - .withExposedPorts(REST_PORT); + private final @NotNull GenericContainer swarm = + new GenericContainer<>(OciImages.getImageName("hivemq/hivemq-swarm")).withNetwork(network) + .withNetworkAliases("swarm") + .withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881") + .withEnv("SWARM_COMMANDER_MODE", "rest") + .withEnv("SWARM_REST_ENABLED", "true") + .withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true") + .withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT)) + .withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0") + .waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1)) + .withEnv("LOG_LEVEL", "DEBUG") + .withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String())) + .withExposedPorts(REST_PORT); private @NotNull CommandLine commandLine; private @NotNull PrintStream out; diff --git a/src/integrationTest/java/com/hivemq/cli/commands/swarm/run/SwarmRunStartCommandIT.java b/src/integrationTest/java/com/hivemq/cli/commands/swarm/run/SwarmRunStartCommandIT.java index 7c1617556..2e264cd80 100644 --- a/src/integrationTest/java/com/hivemq/cli/commands/swarm/run/SwarmRunStartCommandIT.java +++ b/src/integrationTest/java/com/hivemq/cli/commands/swarm/run/SwarmRunStartCommandIT.java @@ -51,25 +51,24 @@ public class SwarmRunStartCommandIT { - //TODO: Temporary fix, see: https://github.com/testcontainers/testcontainers-java/pull/8302 - private static final @NotNull String IMAGE_NAME = "hivemq/hivemq-swarm:4.22.0"; private static final int REST_PORT = 8080; private final @NotNull Network network = Network.newNetwork(); - private final @NotNull GenericContainer swarm = new GenericContainer<>(IMAGE_NAME).withNetwork(network) - .withNetworkAliases("swarm") - .withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881") - .withEnv("SWARM_COMMANDER_MODE", "rest") - .withEnv("SWARM_REST_ENABLED", "true") - .withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost") - .withEnv("SWARM_AGENT_BIND_PORT", "3881") - .withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true") - .withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT)) - .withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0") - .waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1)) - .withEnv("LOG_LEVEL", "DEBUG") - .withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String())) - .withExposedPorts(REST_PORT); + private final @NotNull GenericContainer swarm = + new GenericContainer<>(OciImages.getImageName("hivemq/hivemq-swarm")).withNetwork(network) + .withNetworkAliases("swarm") + .withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881") + .withEnv("SWARM_COMMANDER_MODE", "rest") + .withEnv("SWARM_REST_ENABLED", "true") + .withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost") + .withEnv("SWARM_AGENT_BIND_PORT", "3881") + .withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true") + .withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT)) + .withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0") + .waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1)) + .withEnv("LOG_LEVEL", "DEBUG") + .withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String())) + .withExposedPorts(REST_PORT); private final @NotNull HiveMQContainer hivemq = new HiveMQContainer(OciImages.getImageName("hivemq/hivemq4")).withNetwork(network) diff --git a/src/integrationTest/java/com/hivemq/cli/commands/swarm/run/SwarmRunStopCommandIT.java b/src/integrationTest/java/com/hivemq/cli/commands/swarm/run/SwarmRunStopCommandIT.java index 11e4482c3..9520505db 100644 --- a/src/integrationTest/java/com/hivemq/cli/commands/swarm/run/SwarmRunStopCommandIT.java +++ b/src/integrationTest/java/com/hivemq/cli/commands/swarm/run/SwarmRunStopCommandIT.java @@ -64,25 +64,24 @@ public class SwarmRunStopCommandIT { - //TODO: Temporary fix, see: https://github.com/testcontainers/testcontainers-java/pull/8302 - private static final @NotNull String IMAGE_NAME = "hivemq/hivemq-swarm:4.22.0"; private static final int REST_PORT = 8080; private final @NotNull Network network = Network.newNetwork(); - private final @NotNull GenericContainer swarm = new GenericContainer<>(IMAGE_NAME).withNetwork(network) - .withNetworkAliases("swarm") - .withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881") - .withEnv("SWARM_COMMANDER_MODE", "rest") - .withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost") - .withEnv("SWARM_AGENT_BIND_PORT", "3881") - .withEnv("SWARM_REST_ENABLED", "true") - .withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true") - .withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT)) - .withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0") - .waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1)) - .withEnv("LOG_LEVEL", "DEBUG") - .withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String())) - .withExposedPorts(REST_PORT); + private final @NotNull GenericContainer swarm = + new GenericContainer<>(OciImages.getImageName("hivemq/hivemq-swarm")).withNetwork(network) + .withNetworkAliases("swarm") + .withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881") + .withEnv("SWARM_COMMANDER_MODE", "rest") + .withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost") + .withEnv("SWARM_AGENT_BIND_PORT", "3881") + .withEnv("SWARM_REST_ENABLED", "true") + .withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true") + .withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT)) + .withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0") + .waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1)) + .withEnv("LOG_LEVEL", "DEBUG") + .withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String())) + .withExposedPorts(REST_PORT); private final @NotNull HiveMQContainer hivemq = new HiveMQContainer(OciImages.getImageName("hivemq/hivemq4")).withNetwork(network) From 530ce8741121c5ba33c6297d46becede318e5c1b Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Mon, 29 Jul 2024 17:29:08 +0200 Subject: [PATCH 5/7] Update gradle-oci to 0.14.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c238c7fca..3c9c521fd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -83,6 +83,6 @@ graalvm-native = { id = "org.graalvm.buildtools.native", version = "0.10.2" } launch4j = { id = "edu.sc.seis.launch4j", version = "3.0.6" } license = { id = "com.github.hierynomus.license", version = "0.16.1" } nebula-ospackage = { id = "com.netflix.nebula.ospackage", version = "11.9.1" } -oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.13.0" } +oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.14.0" } openapi-generator = { id = "org.openapi.generator", version = "4.3.1" } # >= 5.0.0 breaks the tasks shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" } From b3cf6d303e97aded4c6529a44fb13a3f048166d0 Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Wed, 31 Jul 2024 13:37:06 +0200 Subject: [PATCH 6/7] Update gradle-oci to 0.15.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3c9c521fd..3ea6c0cfe 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -83,6 +83,6 @@ graalvm-native = { id = "org.graalvm.buildtools.native", version = "0.10.2" } launch4j = { id = "edu.sc.seis.launch4j", version = "3.0.6" } license = { id = "com.github.hierynomus.license", version = "0.16.1" } nebula-ospackage = { id = "com.netflix.nebula.ospackage", version = "11.9.1" } -oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.14.0" } +oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.15.1" } openapi-generator = { id = "org.openapi.generator", version = "4.3.1" } # >= 5.0.0 breaks the tasks shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" } From 58b3bcd5b912f72bf02c949ce060d7e98d1dddbe Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Tue, 6 Aug 2024 17:02:39 +0200 Subject: [PATCH 7/7] Add platform selection for container images --- build.gradle.kts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index e8a21e100..b6253f256 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -309,6 +309,16 @@ testing { tasks.named("check") { dependsOn(integrationTest, systemTest) } + + tasks.named("integrationTestOciRegistryData", oci.imagesTaskClass) { + val linuxAmd64 = oci.platformSelector(oci.platform("linux", "amd64")) + val linuxArm64v8 = oci.platformSelector(oci.platform("linux", "arm64", "v8")) + platformSelector = if (System.getenv("CI_RUN") != null) { + linuxAmd64 + } else { + linuxAmd64.and(linuxArm64v8) + } + } } }