Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to docker-maven-plugin configuration so M1 mac build runs (almost) clean with -Dstart-containers #25648

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
<!-- Antlr is used by the PanacheQL parser-->
<antlr.version>4.9.2</antlr.version>

<!-- SELinux access label, used when mounting local volumes into containers in tests -->
<volume.access.modifier>:Z</volume.access.modifier>

<!-- Defaults for integration tests -->
<elasticsearch-server.version>7.10.0</elasticsearch-server.version>
<elasticsearch.image>docker.elastic.co/elasticsearch/elasticsearch-oss:${elasticsearch-server.version}</elasticsearch.image>
Expand All @@ -87,6 +90,7 @@
<postgres.image>docker.io/postgres:14.2</postgres.image>
<mariadb.image>docker.io/mariadb:10.7</mariadb.image>
<db2.image>docker.io/ibmcom/db2:11.5.7.0a</db2.image>
<db2.image.platform>${os.family}/${os.arch}</db2.image.platform>
<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>
Expand All @@ -100,7 +104,7 @@
<keycloak.version>18.0.0</keycloak.version>
<keycloak.docker.image>quay.io/keycloak/keycloak:${keycloak.version}</keycloak.docker.image>
<keycloak.docker.legacy.image>quay.io/keycloak/keycloak:${keycloak.version}-legacy</keycloak.docker.legacy.image>

<unboundid-ldap.version>6.0.5</unboundid-ldap.version>

<assertj.version>3.22.0</assertj.version>
Expand Down Expand Up @@ -139,7 +143,7 @@
<build-helper-plugin.version>1.9.1</build-helper-plugin.version>
<revapi-reporter-text.version>0.14.5</revapi-reporter-text.version>
<revapi-reporter-json.version>0.4.5</revapi-reporter-json.version>
<!-- Latest release to be used by api-compatibility-check to check backwards compatibility of the Quarkus API. -->
<!-- Latest release to be used by api-compatibility-check to check backwards compatibility of the Quarkus API. -->
<revapi.oldVersion>1.6.0.Final</revapi.oldVersion>
<revapi.newVersion>${project.version}</revapi.newVersion>
<!-- severity Possible values: equivalent, nonBreaking, potentiallyBreaking, breaking -->
Expand Down Expand Up @@ -361,8 +365,8 @@
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
</exclusion>
<!-- Excluding the API jar as the impl jar also contains the API -->
<exclusion>
Expand Down Expand Up @@ -671,7 +675,7 @@
<groupId>io.quarkus</groupId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencies>
<configuration>
<!-- store outside of target to speed up formatting when mvn clean is used -->
<cachedir>.cache/formatter-maven-plugin-${formatter-maven-plugin.version}</cachedir>
Expand Down Expand Up @@ -1226,6 +1230,32 @@
</properties>
</profile>

<profile>
<id>mac-m1</id>
<activation>
<os>
<arch>aarch64</arch>
</os>
</activation>
<properties>
<!-- Podman compatibility. Currently, mac file systems based on Plan 9 does not support SELinux labeling z and Z should not be used. When they transition to use virtiofsd, it should support SELinux labeling, and then we can use it for better container separation on the Mac.-->
<volume.access.modifier></volume.access.modifier>
<!-- An ARM image for db2 isn't available, but if we explicitly request the amd64 one it all works fine -->
<db2.image.platform>linux/amd64</db2.image.platform>
<!-- See
https://github.com/microsoft/mssql-docker/issues/668 and https://stackoverflow.com/questions/65398641/docker-connect-sql-server-container-non-zero-code-1/66919852#66919852.
The MS SQL image segfaults on ARM. Azure Edge is not fully compatible, but it is better than not running the tests at all.

DockerHub does not list any tags so we have to use latest for the moment.-->
<mssql.image>mcr.microsoft.com/azure-sql-edge:latest</mssql.image>
<!-- See https://stackoverflow.com/questions/65456814/docker-apple-silicon-m1-preview-mysql-no-matching-manifest-for-linux-arm64-v8
and https://www.emmanuelgautier.com/blog/mysql-docker-arm-m1
This hopefully should be temporary -->
<mysql.image>arm64v8/mysql:8-oracle</mysql.image>

</properties>
</profile>

<profile>
<id>jakarta-rewrite</id>
<activation>
Expand Down
3 changes: 2 additions & 1 deletion extensions/reactive-mssql-client/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
</plugins>
</build>
</profile>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no diff ? remove from commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thank you!


<profile>
<id>docker-mssql</id>
<activation>
Expand Down Expand Up @@ -197,5 +199,4 @@
</build>
</profile>
</profiles>

</project>
41 changes: 29 additions & 12 deletions extensions/reactive-mysql-client/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
~ under the License.
-->


<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
Expand Down Expand Up @@ -148,8 +149,24 @@
<configuration>
<images>
<image>
<name>${mariadb.image}</name>
<!-- Be aware when testing healthcheck scripts, caching of named images can cause apparently non-deterministic behaviour.
Change the name if making changes. -->
<name>healthcheck-${mariadb.image}</name>
<alias>quarkus-test-mariadb</alias>
<build>
<from>${mariadb.image}</from>
<healthCheck>
<!-- The exact values for these aren't very important, but it is important they are there -->
<interval>5s</interval>
<timeout>3s</timeout>
<startPeriod>5s</startPeriod>
<retries>5</retries>
<!-- Note that mysqladmin ping returns 0 even if the password is wrong-->
<cmd>
<shell>mysqladmin ping -h localhost || exit 1</shell>
</cmd>
</healthCheck>
</build>
<run>
<network>
<mode>bridge</mode>
Expand All @@ -168,29 +185,28 @@
<date>default</date>
<color>cyan</color>
</log>
<!-- Speed things up a bit by not actually flushing writes to disk -->
Speed things up a bit by not actually flushing writes to disk -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean to remove this comment start?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not. :)
I think my IDE is trolling me, since at one point I was running that test successfully. Will fix.

<tmpfs>/var/lib/mysql</tmpfs>
<wait>
<!-- good docs found at: http://dmp.fabric8.io/#build-healthcheck -->
<tcp>
<mode>direct</mode>
<ports>
<port>3306</port>
</ports>
</tcp>
<!-- good docs found at: http://dmp.fabric8.io/#start-wait -->
<!-- the sqladmin check seems more reliable than a tcp check, especially with
diverse container runtimes -->
<healthy>true</healthy>
<!-- Unfortunately booting MariaDB is slow, needs to set a generous timeout: -->
<time>40000</time>
</wait>
<volumes>
<bind>
<volume>${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d:Z</volume>
<volume>
${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d${volume.access.modifier}
</volume>
</bind>
</volumes>
</run>
</image>
</images>
<!--Stops all mariadb images currently running, not just those we just started.
Useful to stop processes still running from a previously failed integration test run -->
<!-- Stops all mariadb images currently running, not just those we just started.
Useful to stop processes still running from a previously failed integration test run -->
<allContainers>true</allContainers>
</configuration>
<executions>
Expand All @@ -199,6 +215,7 @@
<phase>compile</phase>
<goals>
<goal>stop</goal>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
Expand Down
41 changes: 39 additions & 2 deletions extensions/reactive-oracle-client/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,16 @@
<ORACLE_PASSWORD>hibernate_orm_test</ORACLE_PASSWORD>
</env>
<log>
<prefix>Oracle Database: </prefix>
<prefix>Oracle Database:</prefix>
<date>default</date>
<color>red</color>
</log>
<wait>
<!-- good docs found at: http://dmp.fabric8.io/#build-healthcheck -->
<!-- Unfortunately booting this is slow, needs to set a generous timeout: -->
<time>60000</time>
<log>DATABASE IS READY TO USE!</log>
<!-- leversge the healthcheck in the image we use -->
<healthy>yes</healthy>
</wait>
</run>
</image>
Expand Down Expand Up @@ -195,6 +196,42 @@
</plugins>
</build>
</profile>

<!-- In general, we want to avoid os- or arch-based guards on tests, but see
https://github.com/microsoft/mssql-docker/issues/668 and https://stackoverflow.com/questions/65398641/docker-connect-sql-server-container-non-zero-code-1/66919852#66919852.
The MS SQL image segfaults on ARM. -->
<profile>
<id>mac-m1</id>
<activation>
<os>
<arch>aarch64</arch>
</os>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${mssql.image}</name>
<run>
<skip>true</skip>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<artifactId>quarkus-integration-test-hibernate-orm-tenancy</artifactId>
Expand All @@ -12,7 +12,9 @@

<artifactId>quarkus-integration-test-hibernate-orm-tenancy-connection-resolver-legacy-qualifiers</artifactId>
<name>Quarkus - Integration Tests - Hibernate - Tenancy - Connection</name>
<description>Tests for Hibernate ORM Multitenancy using a custom connection resolver and tenant resolver with legacy CDI qualifiers (@Default or @PersistenceUnit), running with the MariaDB database</description>
<description>Tests for Hibernate ORM Multitenancy using a custom connection resolver and tenant resolver with legacy
CDI qualifiers (@Default or @PersistenceUnit), running with the MariaDB database
</description>

<properties>
<mariadb.base_url>jdbc:mariadb://localhost:3306</mariadb.base_url>
Expand Down Expand Up @@ -198,8 +200,24 @@
<configuration>
<images>
<image>
<name>${mariadb.image}</name>
<name>init-healthcheck-${mariadb.image}</name>
<alias>quarkus-test-mariadb</alias>
<build>
<from>${mariadb.image}</from>
<healthCheck>
<!-- The exact values for these aren't very important, but it is important they are there -->
<!-- The exact values for these aren't very important, but it is important they are there -->
<interval>5s</interval>
<timeout>3s</timeout>
<startPeriod>5s</startPeriod>
<retries>5</retries>
<!-- We could also use /usr/local/bin/healthcheck.sh but it seemed complicated to get the right level.
Note that mysqladmin ping returns 0 even if the password is wrong so we don't need to pass in a password, but it makes the logs cleaner-->
<cmd>
<shell>mysqladmin ping -h localhost -u root -psecret|| exit 1</shell>
</cmd>
</healthCheck>
</build>
<run>
<ports>
<port>3308:3306</port>
Expand All @@ -217,21 +235,24 @@
<tmpfs>/var/lib/mysql</tmpfs>
<wait>
<time>20000</time>
<healthy>true</healthy>
<exec>
<breakOnError>true</breakOnError>
<postStart>bash -c eval\ ${@} -- mysql -h localhost -uroot -psecret &lt;/etc/mysql/conf.d/init.sql</postStart>
</exec>
</wait>
<volumes>
<bind>
<volume>${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d:Z</volume>
<volume>
${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d${volume.access.modifier}
</volume>
</bind>
</volumes>
</run>
</image>
</images>
<!--Stops all mariadb images currently running, not just those
we just started. Useful to stop processes still running from a previously
we just started. Useful to stop processes still running from a previously
failed integration test run -->
<allContainers>true</allContainers>
</configuration>
Expand All @@ -241,6 +262,7 @@
<phase>compile</phase>
<goals>
<goal>stop</goal>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
Expand Down
Loading