Skip to content

Commit

Permalink
[#513] detect docker socket location automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
ewilkins-csi committed Dec 20, 2024
1 parent 5753a64 commit d250282
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 120 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,9 @@ The following steps will build aiSSEMBLE. *You must follow the configuration gui
### Helpful Profiles
The aiSSEMBLE baseline project provides several build profiles that may be helpful for different development environments.
To activate each one, use the standard Maven syntax: `./mvnw clean install -P[profile_name]`, for
instance, `./mvnw clean install -PnoRdAdmin`. There are many profiles you can find in the root `pom.xml` file. The
instance, `./mvnw clean install -Pintegration-test`. There are many profiles you can find in the root `pom.xml` file. The
following profiles are often useful when first starting with aiSSEMBLE:
* *noRdAdmin*: For configurations that disallow granting administrator privileges to Rancher Desktop. Testing frameworks
leveraged by aiSSEMBLE may, at times, assume that the docker unix socket is located at `/var/run/docker.sock`, which is
not the case when presented with a non-elevated Rancher installation. Activating this profile will override the
`DOCKER_HOST` seen by these dependencies, pointing it instead at `unix://$HOME/.rd/docker.sock`.
* *integration-test*: Some integration tests require Docker and automatically start/stop Docker Compose services while
executing tests (i.e. see the test/test-mda-models/test-data-delivery-pyspark-patterns module). **Note that the Maven
build does not build the Docker images directly. The images are built within the Kubernetes cluster to speed up
Expand Down
90 changes: 90 additions & 0 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,96 @@ To suppress enforce-helm-version rule, you must add following plugin to the root
<hide.manual.actions>true</hide.manual.actions>
</properties>
</profile>

<!-- Docker host configuration by detecting common docker socket locations -->
<profile>
<!-- Rancher Desktop on Linux/Mac -->
<id>docker-socket-rd</id>
<activation>
<file>
<missing>/var/run/docker.sock</missing>
<exists>${user.home}/.rd/docker.sock</exists>
</file>
<property>
<!-- Always respect DOCKER_HOST env var -->
<name>!env.DOCKER_HOST</name>
</property>
</activation>
<properties>
<docker.host>unix://${user.home}/.rd/docker.sock</docker.host>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>${group.fabric8.plugin}</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<dockerHost>${docker.host}</dockerHost>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
<environmentVariables>
<DOCKER_HOST>${docker.host}</DOCKER_HOST>
<TESTCONTAINERS_HOST_OVERRIDE>${docker.host}</TESTCONTAINERS_HOST_OVERRIDE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<!-- Docker Desktop -->
<id>docker-socket-dd</id>
<activation>
<file>
<missing>/var/run/docker.sock</missing>
<exists>${user.home}/.docker/desktop/docker.sock</exists>
</file>
<property>
<!-- Always respect DOCKER_HOST env var -->
<name>!env.DOCKER_HOST</name>
</property>
</activation>
<properties>
<docker.host>unix://${user.home}/.rd/desktop/docker.sock</docker.host>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>${group.fabric8.plugin}</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<dockerHost>${docker.host}</dockerHost>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
<environmentVariables>
<DOCKER_HOST>${docker.host}</DOCKER_HOST>
<TESTCONTAINERS_HOST_OVERRIDE>${docker.host}</TESTCONTAINERS_HOST_OVERRIDE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>

</project>
28 changes: 0 additions & 28 deletions extensions/extensions-alerting/extensions-alerting-teams/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,32 +121,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>noRdAdmin</id>
<activation>
<property>
<name>BAH_MACHINE</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
<environmentVariables>
<DOCKER_HOST>unix://$HOME/.rd/docker.sock</DOCKER_HOST>
<TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE>$HOME/.rd/docker.sock</TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -136,34 +136,4 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>noRdAdmin</id>
<activation>
<property>
<name>BAH_MACHINE</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
<environmentVariables>
<DOCKER_HOST>unix://$HOME/.rd/docker.sock</DOCKER_HOST>
<TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE>$HOME/.rd/docker.sock
</TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
30 changes: 0 additions & 30 deletions extensions/extensions-pipeline-invocation-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,34 +149,4 @@
</plugin>
</plugins>
</build>


<profiles>
<profile>
<id>noRdAdmin</id>
<activation>
<property>
<name>BAH_MACHINE</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
<environmentVariables>
<DOCKER_HOST>unix://$HOME/.rd/docker.sock</DOCKER_HOST>
<TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE>$HOME/.rd/docker.sock</TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -148,31 +148,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>noRdAdmin</id>
<activation>
<property>
<name>BAH_MACHINE</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
<environmentVariables>
<DOCKER_HOST>unix://$HOME/.rd/docker.sock</DOCKER_HOST>
<TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE>$HOME/.rd/docker.sock</TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit d250282

Please sign in to comment.