Upgrade Infinispan to 14.0.13.Final (#21565)

Closes #21564
This commit is contained in:
Alexander Schwartz 2023-07-20 18:59:19 +02:00 committed by GitHub
parent 2f5a96351d
commit 7c9593f88a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 3 deletions

12
pom.xml
View file

@ -76,7 +76,7 @@
<h2.version>2.2.220</h2.version>
<hibernate-orm.plugin.version>6.2.5.Final</hibernate-orm.plugin.version>
<hibernate.c3p0.version>6.2.5.Final</hibernate.c3p0.version>
<infinispan.version>14.0.10.Final</infinispan.version>
<infinispan.version>14.0.13.Final</infinispan.version>
<infinispan.protostream.processor.version>4.6.2.Final</infinispan.protostream.processor.version>
<!--JAKARTA-->
@ -812,6 +812,16 @@
<artifactId>infinispan-core-jakarta</artifactId>
<version>${infinispan.version}</version>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-commons</artifactId>
<version>${infinispan.version}</version>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-commons-jakarta</artifactId>
<version>${infinispan.version}</version>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-cachestore-remote</artifactId>

View file

@ -26,6 +26,7 @@ import org.testcontainers.containers.MSSQLServerContainer;
import org.testcontainers.containers.MariaDBContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.images.PullPolicy;
import org.testcontainers.utility.DockerImageName;
public class DatabaseContainer {
@ -107,6 +108,13 @@ public class DatabaseContainer {
String MARIADB_IMAGE = System.getProperty("kc.db.mariadb.container.image");
String MYSQL_IMAGE = System.getProperty("kc.db.mysql.container.image");
String INFINISPAN_IMAGE = System.getProperty("kc.infinispan.container.image");
if (INFINISPAN_IMAGE.matches("quay.io/infinispan/.*-SNAPSHOT")) {
// If the image name ends with SNAPSHOT, someone is trying to use a snapshot release of Infinispan.
// Then switch to the closest match of the Infinispan test container
INFINISPAN_IMAGE = INFINISPAN_IMAGE.replaceAll("quay.io/infinispan/", "quay.io/infinispan-test/");
INFINISPAN_IMAGE = INFINISPAN_IMAGE.replaceAll("[0-9]*-SNAPSHOT$", "x");
}
String MSSQL_IMAGE = System.getProperty("kc.db.mssql.container.image");
switch (alias) {
@ -123,8 +131,13 @@ public class DatabaseContainer {
DockerImageName MSSQL = DockerImageName.parse(MSSQL_IMAGE).asCompatibleSubstituteFor("sqlserver");
return configureJdbcContainer(new MSSQLServerContainer<>(MSSQL));
case "infinispan":
return configureInfinispanUser(new GenericContainer<>(INFINISPAN_IMAGE))
GenericContainer<?> infinispanContainer = configureInfinispanUser(new GenericContainer<>(INFINISPAN_IMAGE))
.withExposedPorts(11222);
// the images in the 'infinispan-test' repository point to tags that are frequently refreshed, therefore, always pull them
if (infinispanContainer.getDockerImageName().startsWith("quay.io/infinispan-test")) {
infinispanContainer.withImagePullPolicy(PullPolicy.alwaysPull());
}
return infinispanContainer;
default:
throw new RuntimeException("Unsupported database: " + alias);
}

View file

@ -21,6 +21,7 @@ import org.jboss.logging.Logger;
import org.keycloak.testsuite.arquillian.HotRodContainerProvider;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.images.PullPolicy;
import org.testcontainers.utility.MountableFile;
import java.io.IOException;
@ -50,10 +51,15 @@ public class InfinispanContainer extends GenericContainer<InfinispanContainer> {
private static final Pattern IP_ADDRESS_PATTERN = Pattern.compile("listening on (" + IP_ADDRESS_REGEX + "):" + PORT);
public InfinispanContainer() {
super("quay.io/infinispan/server:" + System.getProperty("infinispan.version"));
super(getImageName());
withEnv("USER", USERNAME);
withEnv("PASS", PASSWORD);
withNetworkMode("host");
// the images in the 'infinispan-test' repository point to tags that are frequently refreshed, therefore, always pull them
if (getImageName().startsWith("quay.io/infinispan-test")) {
withImagePullPolicy(PullPolicy.alwaysPull());
}
Path dir = Path.of(Path.of("").toAbsolutePath() + "/target/lib");
String projectVersion = System.getProperty("project.version");
@ -72,6 +78,17 @@ public class InfinispanContainer extends GenericContainer<InfinispanContainer> {
withStartupTimeout(Duration.ofMinutes(5));
}
private static String getImageName() {
String version = System.getProperty("infinispan.version");
if (version.endsWith("-SNAPSHOT")) {
// for snapshot versions, '14.0.13-SNAPSHOT' translates to '14.0.x'
version = version.replaceAll("[0-9]*-SNAPSHOT$", "x");
return "quay.io/infinispan-test/server:" + version;
} else {
return "quay.io/infinispan/server:" + version;
}
}
@Override
public String getHost() {
if (HOST == null && this.isRunning()) {