mirror of
https://github.com/google/nomulus
synced 2026-02-08 14:00:32 +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:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user