Skip to content

Commit

Permalink
Database image tag alignments and updates in context of devservices
Browse files Browse the repository at this point in the history
  • Loading branch information
famod committed Feb 3, 2022
1 parent bb5147c commit b7fad49
Show file tree
Hide file tree
Showing 31 changed files with 95 additions and 56 deletions.
7 changes: 4 additions & 3 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@
<!-- Database images for JDBC/Reactive/Hibernate tests -->
<postgres.image>docker.io/postgres:14.1</postgres.image>
<mariadb.image>docker.io/mariadb:10.6</mariadb.image>
<db2.image>docker.io/ibmcom/db2:11.5.5.0</db2.image>
<mssql.image>mcr.microsoft.com/mssql/server:2019-CU8-ubuntu-16.04</mssql.image>
<oracle.image>docker.io/gvenzl/oracle-xe:21.3.0-slim</oracle.image>
<db2.image>docker.io/ibmcom/db2:11.5.7.0</db2.image>
<mssql.image>mcr.microsoft.com/mssql/server:2019-CU15-ubuntu-20.04</mssql.image>
<mysql.image>docker.io/mysql:8.0</mysql.image>
<oracle.image>docker.io/gvenzl/oracle-xe:21-slim</oracle.image>

<!-- Align various dependencies that are not really part of the bom-->
<junit4.version>4.13.2</junit4.version>
Expand Down
9 changes: 0 additions & 9 deletions extensions/devservices/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,4 @@
<artifactId>quarkus-core</artifactId>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.util.Collections;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;

import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.utility.Base58;

public final class ConfigureUtil {

private static final Map<String, Properties> DEVSERVICES_PROPS = new ConcurrentHashMap<>();

private ConfigureUtil() {
}

Expand Down Expand Up @@ -44,25 +48,25 @@ public static String configureSharedNetwork(GenericContainer<?> container, Strin
}

public static String getDefaultImageNameFor(String devserviceName) {
var imageName = LazyProperties.INSTANCE.getProperty(devserviceName + ".image");
var imageName = DEVSERVICES_PROPS.computeIfAbsent(devserviceName, ConfigureUtil::loadProperties)
.getProperty("default.image");
if (imageName == null) {
throw new IllegalArgumentException("No default image configured for " + devserviceName);
throw new IllegalArgumentException("No default.image configured for " + devserviceName);
}
return imageName;
}

private static class LazyProperties {

private static final Properties INSTANCE;

static {
var tccl = Thread.currentThread().getContextClassLoader();
try (InputStream in = tccl.getResourceAsStream("devservices.properties")) {
INSTANCE = new Properties();
INSTANCE.load(in);
} catch (IOException e) {
throw new UncheckedIOException(e);
private static Properties loadProperties(String devserviceName) {
var fileName = devserviceName + "-devservice.properties";
try (InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)) {
if (in == null) {
throw new IllegalArgumentException(fileName + " not found on classpath");
}
var properties = new Properties();
properties.load(in);
return properties;
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ public class DB2DevServicesProcessor {

private static final Logger LOG = Logger.getLogger(DB2DevServicesProcessor.class);

/**
* If you update this remember to update the container-license-acceptance.txt in the tests
*/
public static final String TAG = "11.5.5.1";

@BuildStep
DevServicesDatasourceProviderBuildItem setupDB2(
List<DevServicesSharedNetworkBuildItem> devServicesSharedNetworkBuildItem) {
Expand Down Expand Up @@ -70,7 +65,7 @@ private static class QuarkusDb2Container extends Db2Container {
private String hostName = null;

public QuarkusDb2Container(Optional<String> imageName, OptionalInt fixedExposedPort, boolean useSharedNetwork) {
super(DockerImageName.parse(imageName.orElse("ibmcom/db2:" + DB2DevServicesProcessor.TAG))
super(DockerImageName.parse(imageName.orElseGet(() -> ConfigureUtil.getDefaultImageNameFor("db2")))
.asCompatibleSubstituteFor(DockerImageName.parse("ibmcom/db2")));
this.fixedExposedPort = fixedExposedPort;
this.useSharedNetwork = useSharedNetwork;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default.image=${db2.image}
6 changes: 6 additions & 0 deletions extensions/devservices/mariadb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default.image=${mariadb.image}
6 changes: 6 additions & 0 deletions extensions/devservices/mssql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ public class MSSQLDevServicesProcessor {

private static final Logger LOG = Logger.getLogger(MSSQLDevServicesProcessor.class);

/**
* If you update this remember to update the container-license-acceptance.txt in the tests
*/
public static final String TAG = "2019-CU10-ubuntu-20.04";

@BuildStep
DevServicesDatasourceProviderBuildItem setupMSSQL(
List<DevServicesSharedNetworkBuildItem> devServicesSharedNetworkBuildItem) {
Expand Down Expand Up @@ -69,7 +64,7 @@ private static class QuarkusMSSQLServerContainer extends MSSQLServerContainer {

public QuarkusMSSQLServerContainer(Optional<String> imageName, OptionalInt fixedExposedPort, boolean useSharedNetwork) {
super(DockerImageName
.parse(imageName.orElse(MSSQLServerContainer.IMAGE + ":" + MSSQLDevServicesProcessor.TAG))
.parse(imageName.orElseGet(() -> ConfigureUtil.getDefaultImageNameFor("mssql")))
.asCompatibleSubstituteFor(MSSQLServerContainer.IMAGE));
this.fixedExposedPort = fixedExposedPort;
this.useSharedNetwork = useSharedNetwork;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default.image=${mssql.image}
6 changes: 6 additions & 0 deletions extensions/devservices/mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class MySQLDevServicesProcessor {

private static final Logger LOG = Logger.getLogger(MySQLDevServicesProcessor.class);

public static final String TAG = "8.0.24";
public static final String MY_CNF_CONFIG_OVERRIDE_PARAM_NAME = "TC_MY_CNF";

@BuildStep
Expand Down Expand Up @@ -75,8 +74,8 @@ private static class QuarkusMySQLContainer extends MySQLContainer {

public QuarkusMySQLContainer(Optional<String> imageName, OptionalInt fixedExposedPort, boolean useSharedNetwork) {
super(DockerImageName
.parse(imageName.orElse("docker.io/" + MySQLContainer.IMAGE + ":" + MySQLDevServicesProcessor.TAG))
.asCompatibleSubstituteFor(DockerImageName.parse(MySQLContainer.IMAGE)));
.parse(imageName.orElseGet(() -> ConfigureUtil.getDefaultImageNameFor("mysql")))
.asCompatibleSubstituteFor(DockerImageName.parse(MySQLContainer.NAME)));
this.fixedExposedPort = fixedExposedPort;
this.useSharedNetwork = useSharedNetwork;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default.image=${mysql.image}
6 changes: 6 additions & 0 deletions extensions/devservices/oracle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class OracleDevServicesProcessor {
private static final Logger LOG = Logger.getLogger(OracleDevServicesProcessor.class);

public static final String IMAGE = "gvenzl/oracle-xe";
public static final String TAG = "21.3.0-slim";
public static final String DEFAULT_DATABASE_USER = "quarkus";
public static final String DEFAULT_DATABASE_PASSWORD = "quarkus";
public static final String DEFAULT_DATABASE_NAME = "quarkusdb";
Expand Down Expand Up @@ -74,8 +73,7 @@ private static class QuarkusOracleServerContainer extends OracleContainer {
public QuarkusOracleServerContainer(Optional<String> imageName, OptionalInt fixedExposedPort,
boolean useSharedNetwork) {
super(DockerImageName
.parse(imageName
.orElse("docker.io/" + OracleDevServicesProcessor.IMAGE + ":" + OracleDevServicesProcessor.TAG))
.parse(imageName.orElseGet(() -> ConfigureUtil.getDefaultImageNameFor("oracle")))
.asCompatibleSubstituteFor(OracleDevServicesProcessor.IMAGE));
this.fixedExposedPort = fixedExposedPort;
this.useSharedNetwork = useSharedNetwork;
Expand Down
6 changes: 6 additions & 0 deletions extensions/devservices/postgresql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public class PostgresqlDevServicesProcessor {

private static final Logger LOG = Logger.getLogger(PostgresqlDevServicesProcessor.class);

public static final String TAG = "14.1";

@BuildStep
ConsoleCommandBuildItem psqlCommand(DevServicesLauncherConfigResultBuildItem devServices) {
return new ConsoleCommandBuildItem(new PostgresCommand(devServices));
Expand Down Expand Up @@ -76,8 +74,7 @@ private static class QuarkusPostgreSQLContainer extends PostgreSQLContainer {

public QuarkusPostgreSQLContainer(Optional<String> imageName, OptionalInt fixedExposedPort, boolean useSharedNetwork) {
super(DockerImageName
.parse(imageName
.orElse("docker.io/" + PostgreSQLContainer.IMAGE + ":" + PostgresqlDevServicesProcessor.TAG))
.parse(imageName.orElseGet(() -> ConfigureUtil.getDefaultImageNameFor("postgresql")))
.asCompatibleSubstituteFor(DockerImageName.parse(PostgreSQLContainer.IMAGE)));
this.fixedExposedPort = fixedExposedPort;
this.useSharedNetwork = useSharedNetwork;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default.image=${postgres.image}
6 changes: 6 additions & 0 deletions extensions/jdbc/jdbc-db2/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
</dependencies>

<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ibmcom/db2:11.5.5.1
${db2.image}
6 changes: 6 additions & 0 deletions extensions/jdbc/jdbc-mssql/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
</dependencies>

<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mcr.microsoft.com/mssql/server:2019-CU10-ubuntu-20.04
${mssql.image}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mcr.microsoft.com/mssql/server:2019-CU10-ubuntu-20.04
${mssql.image}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<maven.compiler.source>11</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>11</maven.compiler.target>
<db2.image>@db2.image@</db2.image>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -56,6 +57,12 @@
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ibmcom/db2:11.5.5.1
${db2.image}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<maven.compiler.source>11</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>11</maven.compiler.target>
<mssql.image>@mssql.image@</mssql.image>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -56,6 +57,12 @@
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mcr.microsoft.com/mssql/server:2019-CU10-ubuntu-20.04
${mssql.image}
1 change: 0 additions & 1 deletion integration-tests/jpa-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

<properties>
<mysql.url>jdbc:mysql://localhost:3306/hibernate_orm_test?allowPublicKeyRetrieval=true</mysql.url>
<mysql.image>mysql:8.0.22</mysql.image>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/jpa-oracle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Authentication parameters might need to be changed in the Quarkus configuration
### Starting Oracle via docker

```
docker run --memory-swappiness=0 --rm=true --name=HibernateTestingOracle -p 1521:1521 -e ORACLE_PASSWORD=hibernate_orm_test gvenzl/oracle-xe:21.3.0-slim
docker run --memory-swappiness=0 --rm=true --name=HibernateTestingOracle -p 1521:1521 -e ORACLE_PASSWORD=hibernate_orm_test gvenzl/oracle-xe:21-slim
```

This will start a local instance with the configuration matching the parameters used by the integration tests of this module.
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/reactive-oracle-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Authentication parameters might need to be changed in the Quarkus configuration
### Starting Oracle via docker

```
docker run --memory-swappiness=0 --rm=true --name=HibernateTestingOracle -p 1521:1521 -e ORACLE_PASSWORD=hibernate_orm_test gvenzl/oracle-xe:21.3.0-slim
docker run --memory-swappiness=0 --rm=true --name=HibernateTestingOracle -p 1521:1521 -e ORACLE_PASSWORD=hibernate_orm_test gvenzl/oracle-xe:21-slim
```

This will start a local instance with the configuration matching the parameters used by the integration tests of this module.

0 comments on commit b7fad49

Please sign in to comment.