mirror of
https://github.com/google/nomulus
synced 2025-12-23 06:15:42 +00:00
Make a best effort attempt to support multiple CPU architectures (#2672)
I obtained access to an IBM s390x VM so I thought I'd see how multi-arch Nomulus is. Our main application is in Java so it is already multi-arch, but several tests use docker images that are by default x64. Luckily postgres has an s390x port, but selenium does not. So I had to disable Screenshot tests when the arch is not amd64.
This commit is contained in:
@@ -178,6 +178,7 @@ dependencies {
|
||||
|
||||
implementation deps['org.flywaydb:flyway-core']
|
||||
implementation deps['org.flywaydb:flyway-database-postgresql']
|
||||
implementation deps['org.testcontainers:testcontainers']
|
||||
|
||||
runtimeOnly deps['com.google.cloud.sql:postgres-socket-factory']
|
||||
runtimeOnly deps['org.postgresql:postgresql']
|
||||
@@ -190,8 +191,6 @@ dependencies {
|
||||
testImplementation deps['org.junit.jupiter:junit-jupiter-api']
|
||||
testImplementation deps['org.junit.jupiter:junit-jupiter-engine']
|
||||
testImplementation deps['org.junit.platform:junit-platform-launcher']
|
||||
testImplementation deps['org.testcontainers:postgresql']
|
||||
testImplementation deps['org.testcontainers:testcontainers']
|
||||
testImplementation deps['org.testcontainers:junit-jupiter']
|
||||
testImplementation deps['org.testcontainers:postgresql']
|
||||
testImplementation project(path: ':common', configuration: 'testing')
|
||||
|
||||
@@ -10,9 +10,9 @@ com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2=compileClasspath,d
|
||||
com.fasterxml.jackson:jackson-bom:2.15.2=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.ben-manes.caffeine:caffeine:3.0.5=annotationProcessor,errorprone,testAnnotationProcessor
|
||||
com.github.ben-manes.caffeine:caffeine:3.2.0=testCompileClasspath,testRuntimeClasspath
|
||||
com.github.docker-java:docker-java-api:3.4.0=testCompileClasspath,testRuntimeClasspath
|
||||
com.github.docker-java:docker-java-transport-zerodep:3.4.0=testCompileClasspath,testRuntimeClasspath
|
||||
com.github.docker-java:docker-java-transport:3.4.0=testCompileClasspath,testRuntimeClasspath
|
||||
com.github.docker-java:docker-java-api:3.4.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.docker-java:docker-java-transport-zerodep:3.4.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.docker-java:docker-java-transport:3.4.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.jnr:jffi:1.3.13=deploy_jar,runtimeClasspath,testRuntimeClasspath
|
||||
com.github.jnr:jnr-a64asm:1.0.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
|
||||
com.github.jnr:jnr-constants:0.10.4=deploy_jar,runtimeClasspath,testRuntimeClasspath
|
||||
@@ -79,10 +79,10 @@ jakarta.inject:jakarta.inject-api:1.0.5=testCompileClasspath,testRuntimeClasspat
|
||||
javax.inject:javax.inject:1=annotationProcessor,errorprone,testAnnotationProcessor
|
||||
joda-time:joda-time:2.13.1=testCompileClasspath,testRuntimeClasspath
|
||||
junit:junit:4.13.2=testCompileClasspath,testRuntimeClasspath
|
||||
net.java.dev.jna:jna:5.13.0=testCompileClasspath,testRuntimeClasspath
|
||||
net.java.dev.jna:jna:5.13.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
net.sf.saxon:Saxon-HE:10.6=checkstyle
|
||||
org.antlr:antlr4-runtime:4.9.3=checkstyle
|
||||
org.apache.commons:commons-compress:1.24.0=testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.commons:commons-compress:1.24.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.httpcomponents:httpclient:4.5.14=deploy_jar,runtimeClasspath,testRuntimeClasspath
|
||||
org.apache.httpcomponents:httpcore:4.4.16=deploy_jar,runtimeClasspath,testRuntimeClasspath
|
||||
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath
|
||||
@@ -99,14 +99,14 @@ org.jacoco:org.jacoco.ant:0.8.12=jacocoAnt
|
||||
org.jacoco:org.jacoco.core:0.8.12=jacocoAnt
|
||||
org.jacoco:org.jacoco.report:0.8.12=jacocoAnt
|
||||
org.javassist:javassist:3.28.0-GA=checkstyle
|
||||
org.jetbrains:annotations:17.0.0=testCompileClasspath,testRuntimeClasspath
|
||||
org.jetbrains:annotations:17.0.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.jspecify:jspecify:1.0.0=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-api:5.12.0-M1=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-engine:5.12.0-M1=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-commons:1.12.0-M1=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-engine:1.12.0-M1=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-launcher:1.12.0-M1=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit:junit-bom:5.12.0-M1=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-api:5.12.0-RC1=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-engine:5.12.0-RC1=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-commons:1.12.0-RC1=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-engine:1.12.0-RC1=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-launcher:1.12.0-RC1=testCompileClasspath,testRuntimeClasspath
|
||||
org.junit:junit-bom:5.12.0-RC1=testCompileClasspath,testRuntimeClasspath
|
||||
org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath
|
||||
org.ow2.asm:asm-analysis:9.7.1=deploy_jar,runtimeClasspath,testRuntimeClasspath
|
||||
org.ow2.asm:asm-commons:9.7=jacocoAnt
|
||||
@@ -119,12 +119,12 @@ org.ow2.asm:asm:9.7.1=deploy_jar,runtimeClasspath,testRuntimeClasspath
|
||||
org.pcollections:pcollections:3.1.4=annotationProcessor,errorprone,testAnnotationProcessor
|
||||
org.postgresql:postgresql:42.7.5=deploy_jar,runtimeClasspath,testRuntimeClasspath
|
||||
org.reflections:reflections:0.10.2=checkstyle
|
||||
org.rnorth.duct-tape:duct-tape:1.0.8=testCompileClasspath,testRuntimeClasspath
|
||||
org.slf4j:slf4j-api:1.7.36=testCompileClasspath
|
||||
org.rnorth.duct-tape:duct-tape:1.0.8=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.slf4j:slf4j-api:1.7.36=compileClasspath,testCompileClasspath
|
||||
org.slf4j:slf4j-api:2.0.16=deploy_jar,runtimeClasspath,testRuntimeClasspath
|
||||
org.testcontainers:database-commons:1.20.4=testCompileClasspath,testRuntimeClasspath
|
||||
org.testcontainers:jdbc:1.20.4=testCompileClasspath,testRuntimeClasspath
|
||||
org.testcontainers:junit-jupiter:1.20.4=testCompileClasspath,testRuntimeClasspath
|
||||
org.testcontainers:postgresql:1.20.4=testCompileClasspath,testRuntimeClasspath
|
||||
org.testcontainers:testcontainers:1.20.4=testCompileClasspath,testRuntimeClasspath
|
||||
org.testcontainers:testcontainers:1.20.4=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
empty=implementationApi,schema
|
||||
|
||||
@@ -13,15 +13,27 @@
|
||||
// limitations under the License.
|
||||
package google.registry.persistence;
|
||||
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
|
||||
/** Information about Nomulus' Cloud SQL PostgreSql instance. */
|
||||
public class NomulusPostgreSql {
|
||||
|
||||
/** Get the current system architecture, used to deduce the docker image name. */
|
||||
private static final String ARCH = System.getProperty("os.arch");
|
||||
|
||||
/** The current PostgreSql version in Cloud SQL. */
|
||||
// TODO(weiminyu): setup periodic checks to detect version changes in Cloud SQL.
|
||||
private static final String TARGET_VERSION = "11.21-alpine";
|
||||
|
||||
/** Returns the docker image tag of the targeted Postgresql server version. */
|
||||
public static String getDockerTag() {
|
||||
return "postgres:" + TARGET_VERSION;
|
||||
/**
|
||||
* Returns the docker image of the targeted Postgresql server version.
|
||||
*
|
||||
* <p>If the architecture is not amd64, the image will be prefixed with the architecture name.
|
||||
*
|
||||
* @see <a href="https://hub.docker.com/_/postgres">Postgres Docker Hub</a>
|
||||
*/
|
||||
public static DockerImageName getDockerImageName() {
|
||||
String image = (ARCH.equals("amd64") ? "" : ARCH + "/") + "postgres:" + TARGET_VERSION;
|
||||
return DockerImageName.parse(image).asCompatibleSubstituteFor("postgres");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class SchemaTest {
|
||||
*/
|
||||
@Container
|
||||
private final PostgreSQLContainer<?> sqlContainer =
|
||||
new PostgreSQLContainer<>(NomulusPostgreSql.getDockerTag())
|
||||
new PostgreSQLContainer<>(NomulusPostgreSql.getDockerImageName())
|
||||
.withClasspathResourceMapping(
|
||||
MOUNTED_RESOURCE_PATH, CONTAINER_MOUNT_POINT, BindMode.READ_WRITE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user